* {
    box-sizing: border-box;
    font-size: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif
}

body, html {
    height: 100%;
    margin: 0;
    position: relative;
}

body {
    height: auto!important;
    min-height: 100%;
}

a {
    text-decoration: none;
    color: #442;
}

p, h1, h2, h3, h4, ul, li {
    font-size: 1rem;
    line-height: 2em;
}

h2 {
    margin-block-start: 2.5em;
}

h2 {
    opacity: 0.7;
}

.main-container {
    width: 100%;
    max-width: 1024px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 0 1rem;
    height: auto!important;
}

header, footer {
    flex: 0 1 200px;
}

.container {
    flex: 1 0 100%;
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
}

.container > main {
    flex: 1 0 auto;
}

.container > .side-nav {
    margin-top: 4em;
    flex: 0 1 auto;
    display: flex;
    flex-direction: column;
}

.container > .side-nav > a {
    flex: 0 1 auto;
    margin: 1em 0;
}

.container > .side-nav > hr {
    flex: 0 1 auto;
    margin: 0.67em 0 0;
    opacity: 0.3;
}

footer {
    flex-basis: 100px;
}

header > div, footer > div {
    position: absolute;
    width: 100%;
    left: 0;
    box-shadow: 0 0 10px -4px #333;
    padding: 0;
}

footer > div {
    bottom: 0;
    padding: 1rem;
}

.footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.footer-links {
    margin-left: auto;
    white-space: nowrap;
}

nav {
    display: flex;
}

nav > a {
    flex: 1;
    text-align: center;
}

p.title {
    height: 3rem;
    padding: 1rem;
    color: transparent;
    background: url(../img/tom-candy.svg) no-repeat 1rem center;
    background-size: auto 2.5rem;
}

.home p.title {
    height: 300px;
    background-size: auto 27%;
    background-position: 1rem 1rem;
}

.home header {
    flex-basis: 400px;
}

.home header > div {
    background: url(../img/tom-candy.jpg) no-repeat right bottom;
    background-size: auto 100%;
}

p.en > a, a.en {
    vertical-align: super;
    font-size: 0.7em;
    opacity: 0.8;
    font-weight: bold;
}

a.fb {
    color: #3f3fef;
}

blockquote {
    font-size: 1.1em;
    line-height: 2.25em;
    font-family: Georgia, "Times New Roman", sans-serif;
    margin-top: 2em;
}

blockquote + p {
    text-align: right;
    font-style: italic;
    margin: 1em 0 2em;
}

.story-illustration {
    margin: 2rem 0 3rem;
    text-align: center;
}

.story-illustration img {
    display: block;
    width: 100%;
    height: auto;
}

.story-illustration figcaption {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    font-style: italic;
    opacity: 0.7;
}

.ai-story-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    list-style: none;
    margin: 1.5rem 0 2.5rem;
    padding: 0;
}

.ai-story-list > li {
    list-style: none;
    min-width: 0;
}

.ai-story-card {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 5fr);
    align-items: center;
    gap: 1.25rem;
    padding: 1rem;
    border: 1px solid #e3dfd4;
    border-radius: 0.6rem;
    background: #faf9f6;
    box-shadow: 0 2px 9px rgba(30, 26, 18, 0.06);
}

.ai-story-list > li:nth-child(even) .ai-story-card {
    grid-template-columns: minmax(0, 5fr) minmax(0, 2fr);
}

.ai-story-list > li:nth-child(even) .ai-story-cover {
    grid-column: 2;
    grid-row: 1;
}

.ai-story-list > li:nth-child(even) .ai-story-copy {
    grid-column: 1;
    grid-row: 1;
}

.ai-story-card:hover,
.ai-story-card:focus-visible {
    border-color: #9a8c69;
    box-shadow: 0 4px 14px rgba(30, 26, 18, 0.12);
}

.ai-story-card:focus-visible {
    outline: 2px solid #665738;
    outline-offset: 2px;
}

.ai-story-cover {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 18 / 25;
    object-fit: cover;
    object-position: center top;
    border-radius: 0.3rem;
}

.ai-story-copy {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
    line-height: 1.4;
}

.ai-story-copy strong {
    font-size: 1.3rem;
    line-height: 1.25;
}

.ai-story-card:hover .ai-story-copy strong,
.ai-story-card:focus-visible .ai-story-copy strong {
    text-decoration: underline;
}

.ai-story-copy small {
    color: #6d6658;
    font-size: 0.78rem;
    line-height: 1.3;
}

@media only screen and (max-width: 699px) {
    header, footer, .home header {
        flex: 0 1 150px;
    }

    .ai-story-card {
        grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    }

    .ai-story-list > li:nth-child(even) .ai-story-card {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    }
}

@media only screen and (min-width: 700px) {
    .home header > div {
        background-size: 100% auto;
    }
}

@media only screen and (min-width: 1024px) {
    .container {
        flex-direction: row;
    }

    .container > main {
        flex-basis: 70%;
        padding-right: 2rem;
    }

    .container > .side-nav {
        margin-top: 0;
        padding-left: 2rem;
        flex-basis: 280px;
    }
}

/* Colours */
header > div, footer > div {
    background-color: #f3f3f3;
}

.top-nav {
    background-color: #0e0e0e;
    padding: 1rem 0;
}

.top-nav > a {
    color: #f3f3f3;
}
