:root {
    --bg: #0d0d0f;
    --paper: #ebdcb9;
    --text: #c8c9cc;
    --text-muted: #828387;

    --terra: #ce5231;
    --life: #6e961d;
    --water: #347fa6;
    --aether: #7c7c82;

    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --max-width: 68ch;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    line-height: 1.6;
    padding: clamp(1.5rem, 6vw, 4rem);
    display: flex;
    justify-content: center;
}

p, ul.story-parts li, h1, h2, h3, h4 {
    -webkit-hyphens: auto;
    hyphens: auto;
    
    hyphenate-limit-chars: 6 3 3; 
}

#container {
width: 100%;
max-width: var(--max-width);
}

h1 {
    font-size: clamp(1.6rem, 3.5vw, 2.2rem);
    color: var(--paper);
    line-height: 1.2;
    margin-bottom: 0.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h2 {
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    color: var(--paper);
    opacity: 0.9;
    line-height: 1.3;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.meta {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 2.5rem;
}

p {
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

article hr {
    border: 0;
    border-top: 1px solid #1c1c1f;
    margin: 2rem 0;
}

article hr.head-sep,
article hr.foot-sep {
    border-top: 1px solid #222225;
}

.text-terra  { color: var(--terra); }
.text-life   { color: var(--life); }
.text-water  { color: var(--water); }
.text-aether { color: var(--aether); }

.bg-terra  { background-color: var(--terra); color: var(--bg); }
.bg-life   { background-color: var(--life); color: var(--bg); }
.bg-water  { background-color: var(--water); color: var(--bg); }
.bg-aether { background-color: var(--aether); color: var(--bg); }

article {
    position: relative;
}

article::before {
    content: "";
    position: absolute;
    left: -1.5rem;
    top: 0;
    bottom: 0;
    width: 3px;
}

article.terra::before  { background-color: var(--terra); }
article.life::before   { background-color: var(--life); }
article.water::before  { background-color: var(--water); }
article.aether::before { background-color: var(--aether); }

@media (max-width: 768px) {
    article::before {
        left: -0.75rem;
    }
}

:not(pre) > code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background-color: #141417;
    color: var(--paper);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    border: 1px solid #222225;
}

pre {
    background-color: #141417;
    border: 1px solid #222225;
    border-radius: 4px;
    padding: 1.25rem;
    margin: 2rem 0;
    overflow-x: auto;
}

pre code {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: #e2e2e5;
    line-height: 1.5;
    display: block;
}

pre code .comment {
    color: var(--text-muted);
    font-style: italic;
}

a { color: var(--paper); text-decoration: none; transition: 0.3s; }
a:hover { text-decoration: underline; }

.ghost {
    color: var(--aether);
    font-weight: bold;
    display: inline-block;
    position: relative;
    animation: ghost-fade 6s ease-in-out infinite;
    text-shadow: 0 0 0px var(--aether);
}

@keyframes ghost-fade {
    0%, 100% {
        transform: none;
        filter: blur(0);
        opacity: 1;
        text-shadow: 0 0 0px var(--aether);
    }
    45% {
        transform: translate(2px, -1px) scale(1.02);
        filter: blur(1px);
        opacity: 0.8;
        text-shadow: 2px 0 8px var(--aether), -2px 0 8px var(--paper);
    }
    50% {
        transform: translate(-3px, 2px) scale(0.98) skew(5deg);
        filter: blur(3px);
        opacity: 0.4;
    }
    55% {
        transform: translate(1px, -2px) scale(1.01);
        filter: blur(1px);
        opacity: 0.7;
    }
}

img.story-img,
article img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 2rem auto;
    border-radius: 6px;
    border: 1px solid #222225;

    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8), 0 0 10px rgba(235, 220, 185, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

img.story-img:hover,
article img:hover {
    transform: translateY(-2px);
    border-color: var(--aether);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.9), 0 0 15px rgba(124, 124, 130, 0.2);
}

figure {
    margin: 2rem 0;
    text-align: center;
}

figure img {
    margin-bottom: 0.5rem;
}

figcaption {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

img.glow-terra { box-shadow: 0 0 15px rgba(206, 82, 49, 0.25); border-color: var(--terra); }
img.glow-life  { box-shadow: 0 0 15px rgba(110, 150, 29, 0.25); border-color: var(--life); }
img.glow-water { box-shadow: 0 0 15px rgba(52, 127, 166, 0.25); border-color: var(--water); }
img.glow-aether{ box-shadow: 0 0 15px rgba(124, 124, 130, 0.25); border-color: var(--aether); }

ul.story-parts {
    list-style: none;
    padding-left: 0;
    margin: 1.5rem 0;
}

ul.story-parts li {
    margin-bottom: 0.8rem;
    font-family: var(--font-mono);
}

ul.story-parts a {
    color: var(--paper);
    text-decoration: none;
    border-bottom: 1px dashed var(--water);
    padding-bottom: 2px;
    transition: color 0.2s ease, border-color 0.2s ease;
}

ul.story-parts a:hover {
    color: var(--water);
    border-bottom-style: solid;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    margin: 2rem 0;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #1c1c1f;
}

th {
    color: var(--paper);
    font-weight: 600;
    border-bottom: 2px solid #222225;
}

tr:hover td {
    color: var(--paper);
    background-color: #141417;
}

details {
    background-color: #111113;
    border: 1px solid #222225;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    margin: 1.5rem 0;
}

details[open] {
    padding-bottom: 0.25rem;
}

summary {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem 0;
    user-select: none;
    transition: color 0.2s ease;
}

summary:hover {
    color: var(--paper);
}

summary:focus {
    outline: none;
}

svg {
    max-width: 100%;
    height: auto;
    display: block;
}


