:root {
    --bg-color: hsl(0, 0%, 100%);
    --text-color: hsl(0, 0%, 15%);
    --accent-color: hsl(220, 80%, 50%);
    --secondary-text: hsl(0, 0%, 45%);
    --border-color: hsla(0, 0%, 50%, 0.1);
    --hover-bg: hsl(220, 20%, 97%);
    --code-bg: hsl(220, 20%, 97%);
    --max-width: 800px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: hsl(220, 15%, 5%);
        --text-color: hsl(220, 10%, 90%);
        --accent-color: hsl(220, 100%, 65%);
        --secondary-text: hsl(220, 5%, 65%);
        --border-color: hsla(220, 10%, 50%, 0.2);
        --hover-bg: hsl(220, 10%, 12%);
        --code-bg: hsl(220, 10%, 10%);
    }
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 4rem 2rem;
    display: flex;
    justify-content: center;
}

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

header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.logo-container {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 20%;
    background: white;
    flex-shrink: 0;
}

.logo-container img {
    width: 110%;
    height: 110%;
    object-fit: contain;
}

.header-text h1 {
    font-size: 1.8rem;
    margin-bottom: 0;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

.header-text p.subtitle {
    font-size: 0.9rem;
    color: var(--secondary-text);
    margin-bottom: 0.75rem;
}

.org-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--secondary-text);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition);
    padding: 0.4rem 0.8rem;
    border-radius: 2rem;
    background-color: var(--hover-bg);
    border: 1px solid var(--border-color);
}

.org-link:hover {
    color: var(--accent-color);
    background-color: var(--bg-color);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px hsla(220, 80%, 50%, 0.1);
}

.org-link svg {
    flex-shrink: 0;
}

/* --- Content Typography --- */

h1,
h2,
h3,
h4 {
    font-family: 'Outfit', sans-serif;
    line-height: 1.3;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

p {
    margin-bottom: 1.5rem;
}

ul,
ol {
    margin-bottom: 1.5rem;
    margin-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

blockquote {
    border-left: 4px solid var(--accent-color);
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    background-color: var(--hover-bg);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--secondary-text);
}

code {
    font-family: 'Fira Code', 'Cascadia Code', monospace;
    background-color: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}

pre {
    background-color: var(--code-bg);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 2rem 0;
    border: 1px solid var(--border-color);
}

pre code {
    padding: 0;
    background-color: transparent;
    display: block;
    line-height: 1.5;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.95rem;
}

th,
td {
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    text-align: left;
}

th {
    background-color: var(--hover-bg);
    font-weight: 600;
}

hr {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 3rem 0;
}

/* --- SPA Specific Styles --- */

.loader {
    text-align: center;
    padding: 3rem;
    font-size: 1.2rem;
    color: var(--secondary-text);
    font-family: 'Outfit', sans-serif;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

.error {
    background-color: hsla(0, 100%, 50%, 0.1);
    border-left: 4px solid hsl(0, 100%, 50%);
    padding: 1.5rem;
    color: hsl(0, 100%, 40%);
    margin: 2rem 0;
    border-radius: 4px;
}

/* --- Navigation & Links --- */

.series-group {
    margin-top: 1rem;
}

.series-heading {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.parts-list {
    list-style: none;
    margin-left: 2rem;
    border-left: 2px solid var(--border-color);
    padding-left: 1.5rem;
}

.blog-link {
    display: block;
    padding: 1.25rem 1rem;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    border-radius: 0.75rem;
    margin: 0.5rem -1rem;
}

.blog-link:hover {
    background-color: var(--hover-bg);
    transform: translateX(8px);
}

.blog-link .blog-title {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
}

.blog-link:hover .blog-title {
    color: var(--accent-color);
}

.blog-meta {
    font-size: 0.95rem;
    color: var(--secondary-text);
}

.intro-link {
    border-bottom: 2px solid var(--accent-color);
    background-color: var(--hover-bg);
    margin-bottom: 2rem;
}

.navigation-links {
    display: flex;
    justify-content: space-between;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.navigation-links a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.navigation-links a:hover {
    text-decoration: underline;
}

nav.breadcrumb {
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

nav.breadcrumb a {
    color: var(--accent-color);
    text-decoration: none;
}

nav.breadcrumb span {
    color: var(--secondary-text);
    margin: 0 0.5rem;
}

/* --- Article Content Transitions --- */

article.content {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

article.content h1 {
    font-size: 3rem;
    margin-top: 0;
    margin-bottom: 2rem;
}

footer {
    margin-top: 6rem;
    font-size: 0.85rem;
    color: var(--secondary-text);
    text-align: center;
}

footer a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
    border-bottom: 1px solid transparent;
}

footer a:hover {
    color: var(--accent-color);
    border-bottom: 1px solid var(--accent-color);
}