* { margin: 0; }

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select { font: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
p { text-wrap: pretty; }
h1, h2, h3, h4, h5, h6 { text-wrap: balance; }
/** end reset **/

:root {
    --left-gap: 4rem;
    --left-hang-gap: 3rem;
    --spacing: 2rem;
    --hero-height: var(--spacing);
    --rhythm: 1rem;
    --max-width: 55ch;
    --centering: 0;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
}

body {
    display: grid;
    gap: var(--spacing) 0;
    grid-template-rows: var(--hero-height) auto 1fr auto;
    grid-template-columns: var(--left-hang-gap) var(--centering) minmax(auto, var(--max-width)) 1fr var(--centering) var(--left-hang-gap);
    grid-template-areas:
        "hero hero hero hero hero hero"
        ". header header app-header app-header ."
        ". . main app-main . ."
        ". footer footer footer footer .";
}

body.with-hero { --hero-height: auto; }
body.no-hero { --hero-height: 0; }
.hero { grid-area: hero; }

body.center { --centering: 1fr; }

@media (max-width: 40rem) {
    :root {
        --left-gap: 2rem;
        --left-hang-gap: 1.5rem;
    }
}

/*** customisation ----------------------- */
.app-hidden { display: none; }

/*** header ------------------------------ */
header {
    grid-area: header;
}
header > h1, header hgroup {
    max-width: var(--max-width);
}
header p {
    max-width: var(--max-width);
    margin-top: var(--rhythm);
}
header hgroup {
    display: flex;
    gap: var(--rhythm);
}
header hgroup > * { margin: 0; display: inline-block; }
.hero { max-width: 100%; padding: var(--spacing) var(--left-gap); }
.hero img { height: auto; max-width: 100%; }

header.full-width {
    display: flex;
    justify-content: space-between;
    padding-top: 0;
    grid-area: header-start / header-start / header-start / app-header-end;
}
header.h-app h1 {
    font-size: 100%;
    margin: 0;
}
header.h-app h1 a { color: var(--silver); }
header.h-app ul {
    margin: 0;
    list-style: none;
    display: flex;
    gap: var(--rhythm);
}
header.h-app ul a { color: var(--red); }
header.h-app ul a:hover { color: var(--darkred); }

/*** main -------------------------------- */
main { grid-area: main; }
main > *:first-child { margin-top: 0 !important; }
main h2 { margin-top: var(--rhythm); }
main p { margin: var(--rhythm); }
main.full-width { grid-area: main-start / main-start / main-start / app-main-end; }

main dl { margin: 1rem; }
main dl dd { margin-left: 1rem; }

/*** footer ------------------------------ */
footer {
    grid-area: footer;
    display: flex;
    justify-content: space-between;
    line-height: 3.4;
}

footer nav ul {
    padding: 0;
    display: flex;
    list-style: none;
}

footer nav li:not(:last-child):after {
    content: '>';
    margin: 0 .5rem;
}

/*** colouring in ***/
:root {
    --red: hsl(358, 68%, 45%);
    --darkred: hsl(358, 68%, 30%);
    --purple: hsl(260, 68%, 30%);
    --silver: silver;
    font-size: calc(14px + 0.2vw);
}

body { font: 100%/1.4 verdana, system-ui, sans-serif; }
body.blue {
    --red: hsl(220 52% 44%);
    --darkred: hsl(208 56% 38%);
}

header h1 { font-size: 150%; }
header hgroup p { font-size: 150%; }
.hero img { box-shadow: 0 1px 5px rgba(0,0,0,.3), 0 0 10px rgba(0,0,0,.2); border-radius: 4px;}

h2 { font-style: italic; font-weight: normal; font-size: 100%; text-transform: lowercase; }
h2 + p { margin-top: 0; }

a {
    color: var(--red);
    text-decoration: underline;
    text-decoration-thickness: 10%;
    text-underline-offset: 10%;
}
a:hover { color: var(--darkred); }
a:active { color: var(--purple); }
header a, footer a { color: unset; text-decoration: unset; }

code { font-size: 0.85rem; }
pre {
    border-top: 1px dashed var(--silver);
    border-bottom: 1px dashed var(--silver);
    padding: var(--rhythm) 0;
    overflow-x: auto;
    margin: 1rem;
}

footer {
    font-size: 80%;
    border-top: 1px solid var(--silver);
}

footer nav li:not(:last-child):after {
    color: var(--silver);
}

footer ul li:last-child {
    text-decoration: line-through;
}

ul, ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

a, a:visited {
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

form[data-toggled] {
    display: none;
}

form[data-toggled].open {
    display: block;
}

form {
    position: absolute;
    top: calc(var(--spacing) * 2);
    right: var(--left-hang-gap);
    border: 1px solid var(--silver);
    padding: 2rem;
    max-width: 21rem;
    width: 100%;
    background: white;
    z-index: 1000;
}

input[type=text] {
    display: block;
    margin-top: .5rem;
    width: 100%;
}

button {
    margin-top: 1.5rem;
}

main code {
    display: none;
    color: var(--red);
    float: right;
    margin-right: 2rem;
}

main code.open {
    display: inline-block;
}

main h2 {
    font-size: 1rem;
    margin: 0;
    display: inline-block;
    font-style: normal;
    font-weight: bold;
}

main .toggle {
    display: block;
    position: absolute;
    width: 1rem;
    transition: .1s;
    user-select: none;
    background: var(--background);
    padding: 0.2rem;
}

main .open .toggle {
    transform: rotate(90deg);
    margin-top: .3rem;
}

main ul > li {
    margin: 1rem 0;
}

main ul > li .remove {
    display: none;
    background: var(--red);
    color: white;
    font-size: .8rem;
    border-radius: 10em;
    padding: .3em;
    text-align: center;
    line-height: .69rem;
    height: 1em;
    width: 1em;
    margin-top: -3px;
    position: absolute;
    right: 3rem;
}

main .remove.open {
    display: inline-block;
}

main ul > li:hover .remove:hover, ul > li:hover .remove:active {
    text-decoration: none;
    background: var(--darkred);
}

main ol {
    display: flex;
    overflow-x: hidden;
    position: relative;
    margin-top: .25rem;
    margin-left: 1.5rem;
}

main ol:after {
    content: "";
    background-image: linear-gradient(90deg, transparent, white);
    position: absolute;
    z-index: 999;
    right: 0;
    width: var(--left-gap);
    height: 100%;
}

main li.open ol {
    flex-direction: column;
    gap: .2rem;
}

main li.open ol:after {
    display: none;
}

main ol li {
    white-space: nowrap;
    display: flex;
}

main ol li time {
    margin: .2rem 0 0 .3rem;
}

main li:not(.open) ol li:not(:last-child):after {
    font-size: .8rem;
    content: '/';
    color: var(--silver);
    margin: .2rem 1ch 0;
}

main h3 {
    font-size: 1rem;
    font-weight: normal;
    margin: 0;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 2 * var(--left-gutter));
    text-wrap: nowrap;
}

main li:not(.open) ol h3 {
    max-width: 22rem;
}

main h3 a:visited {
    color: var(--foreground);
}

main time {
    font-size: .8rem;
    font-weight: 300;
}

#cover {
    top: 0;
    left: 0;
    z-index: 1000;
    position: absolute;
    height: 100%;
    width: 100%;
    background: rgba(0, 255, 255, .7);
    display: block
    padding: 0;
    margin: 0;
}

#cover a {
    color: black;
    position: relative;
    display: block;
    left: 50%;
    top: 50%;
    text-align: center;
    width: 100px;
    margin-left: -50px;
    height: 50px;
    line-height: 50px;
    margin-top: -25px;
    font-size: 16px;
    font-weight: bold;
    border: 1px solid;
}

/* Noscript */
body:not(.script) .actions {
    display: none;
}
