redsunlib/static/style.css
2021-01-20 20:59:57 +01:00

977 lines
16 KiB
CSS

/* Define themes */
/* Constants */
:root {
--nsfw: #ff5c5d;
--admin: #ea0027;
}
/* Automatic theme selection */
:root, .dark{
/* Default & fallback theme (dark) */
--accent: aqua;
--green: #5cff85;
--text: white;
--foreground: #222;
--background: #0f0f0f;
--outside: #1f1f1f;
--post: #161616;
--panel-border: 1px solid #333;
--highlighted: #333;
--shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
/* Browser-defined light theme */
@media (prefers-color-scheme: light) {
:root {
--accent: #009a9a;
--green: #00a229;
--text: black;
--foreground: #f5f5f5;
--background: #ddd;
--outside: #ececec;
--post: #eee;
--panel-border: 1px solid #ccc;
--highlighted: white;
--shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
}
/* Light theme setting */
.light {
--accent: #009a9a;
--green: #00a229;
--text: black;
--foreground: #f5f5f5;
--background: #ddd;
--outside: #ececec;
--post: #eee;
--panel-border: 1px solid #ccc;
--highlighted: white;
--shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
/* General */
::selection {
color: var(--foreground);
background: var(--accent);
}
html, body, div, h1, h2, h3, h4, h5, h6, ul, ol, dl, li, dt, dd, p, blockquote,
pre, form, fieldset, table, th, td, select, input {
margin: 0;
color: var(--text);
font-family: sans-serif;
}
body {
background: var(--background);
font-size: 15px;
}
nav {
display: grid;
grid-template-areas: "logo searchbox code";
justify-content: space-between;
align-items: center;
color: var(--accent);
background: var(--outside);
box-shadow: var(--shadow);
font-size: 20px;
z-index: 1;
top: 0;
padding: 5px 15px;
min-height: 40px;
width: calc(100% - 30px);
position: fixed;
}
nav * { color: var(--text); }
nav #reddit, #code { color: var(--accent); }
nav #logo { grid-area: logo; }
nav #code { grid-area: code; }
nav #version { opacity: 50%; }
#settings_link {
font-size: 18px;
margin-left: 20px;
opacity: 0.8;
}
main {
display: flex;
justify-content: center;
max-width: 1000px;
padding: 10px 20px;
margin: 60px auto 20px auto
}
.wide main {
max-width: calc(100% - 40px);
}
.wide #column_one {
width: 100%;
max-width: 100%;
}
#column_one {
max-width: 750px;
border-radius: 5px;
overflow: hidden;
}
footer {
display: flex;
justify-content: center;
margin-top: 20px;
}
footer > a {
margin-right: 5px;
}
button {
background: none;
border: none;
font-weight: bold;
}
hr {
margin: 20px 0;
}
a {
color: inherit;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
svg {
stroke: var(--text);
}
img[src=""] {
display: none;
}
aside {
flex-grow: 1;
margin: 20px 20px 0 10px;
max-width: 350px;
}
.post, .panel {
border: var(--panel-border);
}
.dot {
font-size: 12px;
opacity: 0.5;
}
/* User & Subreddit */
#user, #subreddit, #sidebar {
margin: 40px auto 0 auto;
display: flex;
flex-direction: column;
align-items: center;
height: max-content;
background: var(--outside);
border-radius: 5px;
overflow: hidden;
}
#user *, #subreddit * { text-align: center; }
#user, #sub_meta, #sidebar_contents { padding: 20px; }
#sidebar, #sidebar_contents { margin-top: 10px; }
#sidebar_label { padding: 10px; }
#user_icon, #sub_icon {
width: 100px;
height: 100px;
border: 2px solid var(--accent);
border-radius: 100%;
padding: 10px;
margin: 10px;
}
#user_title, #sub_title {
margin: 0 20px;
font-size: 20px;
font-weight: bold;
}
#user_description, #sub_description {
margin: 0 20px;
}
#user_name, #user_description:not(:empty), #user_icon
#sub_name, #sub_icon, #sub_description:not(:empty) {
margin-bottom: 20px;
}
#user_details, #sub_details {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-column-gap: 20px;
}
#user_details > label, #sub_details > label {
color: var(--accent);
}
/* Wiki Pages */
#wiki {
background: var(--foreground);
padding: 35px;
}
#top {
background: var(--highlighted);
width: 100%;
display: flex;
}
#top > * {
flex-grow: 1;
text-align: center;
height: 35px;
line-height: 35px;
}
#top > div {
border-bottom: 2px solid var(--text);
}
/* Sorting and Search */
select, #search, #sort_options, #inside, #searchbox > *, #sort_submit {
height: 40px;
}
.search_label {
max-width: 300px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
select {
background: var(--outside);
transition: 0.2s background;
}
select, #search {
border: none;
padding: 0 15px;
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
border-radius: 5px 0px 0px 5px;
}
#searchbox {
grid-area: searchbox;
display: flex;
box-shadow: var(--shadow);
border-radius: 5px;
}
#searchbox > *, #sort_submit { background: var(--highlighted); }
#search {
border-right: 2px var(--outside) solid;
min-width: 0;
flex-grow: 1;
}
#inside {
display: flex;
align-items: center;
border-right: 2px var(--outside) solid;
padding: 0 10px;
}
#restrict_sr { margin-right: 5px; }
input[type="submit"], button.submit {
border: 0;
border-radius: 0px 5px 5px 0px;
}
button.submit {
display: flex;
align-items: center;
}
select:hover { background: var(--foreground); }
input[type="submit"]:hover { color: var(--accent); }
button.submit:hover > svg { stroke: var(--accent); }
#timeframe {
margin: 0 2px;
border-radius: 0;
}
#sort_options + #timeframe:not(#search_sort > #timeframe) {
margin-left: 10px;
border-radius: 5px 0px 0px 5px;
}
#search_sort {
background: var(--highlighted);
border-radius: 5px;
overflow: auto;
}
#search_sort > #search {
border: 0;
background: transparent;
}
#search_sort > *, #searchbox > * { font-size: 15px; }
#search_sort > :not(:first-child), #search_sort > #sort_options {
margin: 0;
border-radius: 0;
border-right: 0;
border-left: 2px solid var(--background);
box-shadow: none;
background: transparent;
}
#sort, #search_sort {
display: flex;
align-items: center;
margin-bottom: 20px;
}
#sort_options, footer > a {
border-radius: 5px;
box-shadow: var(--shadow);
background: var(--outside);
display: flex;
overflow: auto;
}
#sort_options > a, footer > a {
color: var(--text);
padding: 10px 20px;
text-align: center;
cursor: pointer;
transition: 0.2s background;
}
#sort_options > a.selected {
background: var(--accent);
color: var(--foreground);
}
#sort_options > a:not(.selected):hover {
background: var(--foreground);
}
#search_subreddits {
border-radius: 5px;
background: var(--post);
box-shadow: var(--shadow);
transition: 0.2s background;
border: var(--panel-border);
margin-bottom: 20px;
}
.search_subreddit {
padding: 16px 20px;
display: block;
}
a.search_subreddit:hover {
text-decoration: none;
background: var(--foreground);
}
.search_subreddit:not(:last-child) {
border-bottom: 1px solid var(--highlighted);
}
.search_subreddit_header {
margin-bottom: 8px;
}
.search_subreddit_name {
font-weight: bold;
font-size: 16px;
}
.search_subreddit_description {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
opacity: 0.5;
}
/* Post */
.sep {
display: none;
}
.thread {
word-break: break-word;
}
.post {
border-radius: 5px;
background: var(--post);
box-shadow: var(--shadow);
display: grid;
transition: 0.2s background;
grid-template: "post_score post_header post_thumbnail" auto
"post_score post_title post_thumbnail" 1fr
"post_score post_media post_thumbnail" auto
"post_score post_body post_thumbnail" auto
"post_score post_footer post_thumbnail" auto
/ minmax(40px, auto) minmax(0, 1fr) fit-content(min(20%, 152px));
}
.post:not(:last-child) { margin-bottom: 10px; }
.post.highlighted {
margin: 20px 0;
}
.post:hover {
background: var(--foreground);
}
.post_score {
padding-top: 20px;
font-size: 13px;
font-weight: bold;
text-align: end;
color: var(--accent);
grid-area: post_score;
text-align: end;
border-radius: 5px 0 0 5px;
transition: 0.2s background;
}
.post_score .label {
display: none;
}
.post_header {
margin: 20px 20px 5px 20px;
grid-area: post_header;
}
.post_subreddit {
font-weight: bold;
}
.post_title {
font-size: 16px;
line-height: 1.5;
margin: 5px 20px;
grid-area: post_title;
}
.post_flair {
background: var(--accent);
color: var(--background);
padding: 4px;
margin-right: 5px;
border-radius: 5px;
font-size: 12px;
font-weight: bold;
}
.emoji {
width: 1em;
height: 1em;
display: inline-block;
background-size: contain;
background-position: 50% 50%;
background-repeat: no-repeat;
vertical-align: middle;
}
.nsfw {
color: var(--nsfw);
margin-left: 5px;
border: 1px solid var(--nsfw);
padding: 3px;
font-size: 12px;
border-radius: 5px;
font-weight: bold;
}
.post_media {
max-width: calc(100% - 40px);
align-self: center;
margin-top: 15px;
margin: 5px auto;
height: auto;
grid-area: post_media;
background-color: var(--highlighted);
display: table;
}
#post_url {
color: var(--accent);
margin: 5px 20px;
grid-area: post_media;
}
.post_body {
opacity: 0.9;
font-weight: normal;
margin: 5px 20px;
grid-area: post_body;
}
.post_footer {
display: flex;
justify-content: space-between;
opacity: 0.5;
font-size: 14px;
grid-area: post_footer;
margin: 5px 20px 20px 20px;
}
.post_comments {
font-weight: bold;
}
#post_links {
display: flex;
list-style: none;
padding: 0;
font-weight: bold;
}
#post_links > li {
margin-right: 15px;
}
.post_thumbnail {
border-radius: 5px;
border: var(--panel-border);
display: grid;
overflow: hidden;
background-color: var(--background);
grid-area: post_thumbnail;
margin: 5px;
}
.post_thumbnail img {
grid-area: 1 / 1 / 2 / 2;
width: 100%;
height: auto;
object-fit: cover;
align-self: center;
justify-self: center;
}
.post_thumbnail.no_thumbnail {
background-color: var(--highlighted);
}
.post_thumbnail svg {
grid-area: 1 / 1 / 2 / 2;
align-self: center;
justify-self: center;
max-width: 100%;
}
.post_thumbnail span {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
text-align: center;
background-color: rgba(0,0,0,0.8);
color: white;
grid-area: 1 / 1 / 2 / 2;
padding: 5px;
align-self: end;
}
.stickied {
--accent: var(--green);
border: 1px solid var(--green);
}
/* Comment */
.comment {
margin: 10px 0;
border-radius: 5px;
display: flex;
}
.comment_left, .comment_right {
display: flex;
flex-direction: column;
}
.comment_left {
text-align: center;
min-width: 50px;
padding: 5px 0;
align-items: center;
}
.comment_title { font-size: 20px; }
.comment_link { text-decoration: underline; }
.comment_author { opacity: 0.9; }
.author_flair {
background: var(--highlighted);
color: var(--text);
padding: 5px;
margin-right: 5px;
border-radius: 5px;
font-size: 12px;
font-weight: bold;
}
.comment_subreddit {
font-weight: bold;
}
.comment_score {
color: var(--accent);
background: var(--foreground);
min-width: 40px;
border-radius: 5px;
padding: 10px 0;
font-size: 16px;
}
.comment_right {
word-wrap: anywhere;
padding: 10px 0 10px 5px;
flex-grow: 1;
flex-shrink: 1;
}
.comment_data > * {
margin-right: 5px;
}
.comment_image {
max-width: 500px;
align-self: center;
}
.comment_body {
opacity: 0.9;
font-weight: normal;
margin: 10px 5px;
}
.comment_body > p:not(:first-child) {
margin-top: 20px;
}
.comment_body a {
text-decoration: underline;
color: var(--accent);
}
.deeper_replies {
color: var(--accent);
margin-left: 15px;
}
::marker {
color: var(--accent);
}
.replies > .comment {
margin-left: -20px;
padding: 5px;
}
.created {
opacity: 0.5;
}
.line {
width: 2px;
height: 100%;
background: var(--foreground);
}
.moderator, .admin { opacity: 1; }
.op, .moderator, .admin { font-weight: bold; }
.op { color: var(--accent); }
.moderator { color: var(--green); }
.admin { color: var(--admin); }
/* Layouts */
.compact .post:not(.highlighted) {
border-radius: 0;
margin: 0;
padding: 0;
}
.compact .post:first-of-type {
border-radius: 5px 5px 0 0;
overflow: hidden;
}
.compact .post:last-of-type {
border-radius: 0 0 5px 5px;
overflow: hidden;
}
.compact .post.highlighted { border-radius: 5px; }
.compact .post:not(:last-of-type):not(.highlighted):not(.stickied) { border-bottom: 0; }
.compact .post_score {
padding-top: 15px;
border-radius: 0;
}
.compact .post_header {
margin: 15px 15px 2.5px 15px;
font-size: 14px;
}
.compact .post_title, .compact #post_url, .compact .post_body {
margin: 2.5px 15px;
}
.compact .post_media {
max-width: calc(100% - 30px);
margin: 2.5px auto;
}
.compact .post_footer {
margin: 5px 15px 15px 15px;
}
.compact .post_thumbnail {
width: 75px;
height: 75px;
}
.compact footer {
margin-top: 20px;
}
/* Settings */
#settings {
display: flex;
flex-direction: column;
align-items: center;
}
#settings_note {
font-size: 14px;
max-width: 300px;
margin-top: 10px;
opacity: 0.75;
}
#prefs {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
padding: 20px;
background: var(--post);
border-radius: 5px;
}
#prefs > div {
display: flex;
justify-content: space-between;
width: 100%;
height: 35px;
align-items: center;
}
#prefs > div:not(:last-of-type) {
margin-bottom: 10px;
}
#prefs select {
border-radius: 5px;
box-shadow: var(--shadow);
margin-left: 20px;
background: var(--foreground);
}
#save {
background: var(--highlighted);
padding: 10px 15px;
border-radius: 5px;
margin-top: 20px;
}
input[type="submit"] {
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
}
/* Markdown */
.md > *:not(:first-child) {
margin-top: 20px;
}
.md h1 { font-size: 22px; }
.md h2 { font-size: 20px; }
.md h3 { font-size: 18px; }
.md h4 { font-size: 16px; }
.md h5 { font-size: 14px; }
.md h6 { font-size: 12px; }
.md blockquote {
padding: 10px;
margin: 4px 0 4px 5px;
border-left: 4px solid var(--highlighted);
background: var(--post);
}
.md a, .md a * {
color: var(--accent);
}
.md .md-spoiler-text {
background: var(--highlighted);
color: transparent;
}
.md .md-spoiler-text:hover {
background: var(--foreground);
color: var(--text);
}
.md li { margin: 10px 0; }
.toc_child { list-style: none; }
.md pre {
background: var(--outside);
padding: 20px;
margin-top: 10px;
border-radius: 5px;
box-shadow: var(--shadow);
overflow: auto;
}
.md table {
margin: 5px;
}
.md code {
font-family: monospace;
font-size: 14px;
}
.md code:not(.md pre > code) { background: var(--highlighted); }
/* Tables */
table, td, th { border: var(--panel-border); }
table {
border-width: 3px;
border-spacing: 0;
}
td, th {
padding: 10px;
}
/* Mobile */
@media screen and (max-width: 480px) {
.post {
grid-template: "post_header post_header post_thumbnail" auto
"post_title post_title post_thumbnail" 1fr
"post_media post_media post_thumbnail" auto
"post_body post_body post_thumbnail" auto
"post_score post_footer post_thumbnail" auto
/ auto 1fr fit-content(min(20%, 152px));
}
.post_score {
background-color: unset;
margin: 5px 0px 20px 20px;
padding: 0;
}
.compact .post_score {
background-color: unset;
margin: 2.5px 0px 15px 15px;
padding: 0;
font-size: 14px;
}
.post_score::before { content: "↑" }
.post:hover > .post_score { background: unset; }
.post_header { font-size: 14px; }
.post_footer { margin-left: 15px; }
.replies > .comment {
margin-left: -25px;
padding: 5px 0;
}
.comment_left {
min-width: 45px;
padding: 5px 0px;
}
.comment_author { margin-left: 10px; }
.comment_score { min-width: 35px; }
.comment_data::marker { font-size: 18px; }
.created { width: 100%; }
}
@media screen and (max-width: 800px) {
main {
flex-direction: column-reverse;
padding: 10px;
margin: 100px 0 10px 0;
max-width: 100%;
}
nav {
grid-template-areas: 'logo code' 'searchbox searchbox';
padding: 10px;
width: calc(100% - 20px);
}
aside, #subreddit, #user {
margin: 0;
max-width: 100%;
}
#user, #sidebar { margin: 20px 0; }
#logo { margin: 5px auto; }
#searchbox { width: 100%; }
}