/* design inspired by https://github.com/secretGeek/html_wysiwyg/ */

* {
    display:block;
}
a,code,em,strong {
    display:inline 
}
*{
    font-family:Monospace;
    margin:1.5em 0;
    padding:0;
    text-decoration:none 
}


/* pretty typesetting */

* { hanging-punctuation: first allow-end last; }

/* tags with attributes. */

a[href]:focus::before {
    content: "<a href='" attr(href) "'>" 
}
link[rel]::before {
    content: "<link rel='" attr(rel) "' type='" attr(type)"' href='" attr(href) "'>" 
}

:root {
    --body-bg: #f2f2f2;
    --body-color: #333333;
    --tag-color: #898989;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
      --body-bg: #262626;
      --body-color: #d8d8d8;
      --tag-color: #8c8c8c;
  }
}


/* brutify */
*::before,*::after {
    color:var(--tag-color);
    font-weight:100;
    font-size:0.8em;
}
head {
    font-size:1.0em;
}
footer {
    font-size:1.0em;
}
html {
    max-width:80ch;
    padding:2ch;
    margin:auto;
    background: var(--body-bg);
    color:var(--body-color);
    font-size:1.2em;
}

/* remove padding for mobile */
@media screen and (max-width: 84ch) {
    html {
        max-width: 96%;
        padding: 2%;
    }
}


/* special escaping for close style */
style::before {
    content:'<style>';
}
style {
    color:var(--tag-color);
    /* there is some inline style for optimization and it takes too much space */
    display: none;
}
style::after {
    content:'<\/style>';
}
/* here is the highly repetitive bit */
p::before {
    content:'<p>' 
}
p::after {
    content:'</p>' 
}
nav::before {
    content:'<nav>' 
}
nav::after {
    content:'</nav>' 
}
html::before {
    content:'<html>' 
}
html::after {
    content:'</html>' 
}
head::before {
    content:'<head>' 
}
head::after {
    content:'</head>' 
}
title::before {
    content:'<title>' 
}
title::after {
    content:'</title>' 
}
link::before {
    content:'<link>' 
}
link::after {
    content:'</link>' 
}
body::before {
    content:'<body>' 
}
body::after {
    content:'</body>' 
}
footer::before{
    content:'<footer>';
}
footer::after{
    content:'</footer>';
}
h1::before {
    content:'<h1>' 
}
h1::after {
    content:'</h1>' 
}
h2::before {
    content:'<h2>' 
}
h2::after {
    content:'</h2>' 
}
p::before {
    content:'<p>' 
}
p::after {
    content:'</p>' 
}
pre::before {
    content:'<pre>' 
}
pre::after {
    content:'</pre>' 
}
code::before {
    content:'<code>' 
}
code::after {
    content:'</code>' 
}
a:focus::before {
    content:'<a>' 
}
a:focus::after {
    content:'</a>' 
}
aside::before {
    content:'<aside>' 
}
aside::after {
    content:'</aside>' 
}
blockquote::before {
    content:'<blockquote>' 
}
blockquote::after {
    content:'</blockquote>' 
}
em::before {
    content:'<em>' 
}
em::after {
    content:'</em>' 
}
strong::before {
    content:'<strong>' 
}
strong::after {
    content:'</strong>' 
}
ul::before {
   content:'<ul>'
}
ul::after {
   content:'</ul>'
}
li::before {
   content:'\00A0\00A0<li>';
}
li::after {
   content:'</li>';
}
script::before {
    content:'<script>'
}
script {
    color:var(--tag-color)
}
script::after {
    content:'</script>'
}
