/* ==================================================
   George Freedom Web Pages — Design System
   ================================================== */


/* ==================================================
   1. Design Tokens
   ================================================== */

:root {
    color-scheme: light dark;

    /* Colors — light theme*/
    --color-bg: #faf5ea;
    --color-text: #302c27;
    --color-muted: #756b5e;
    --color-border: #d5c9b7;
    --color-accent: #956b45;
    --color-surface: #fafafa;

    /* Colors — links */
    --color-link: #2563eb;
    --color-link-hover: #1d4ed8;

    /* Typography */
    --font-body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-heading: var(--font-body);

    /* Layout */
    --content-width: 960px;
}


/* ==================================================
   2. Theme Settings
   ================================================== */

/* Dark theme — follows system preference */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-bg: #302b20;
        --color-text: #e9e2d6;
        --color-muted: #b6a994;
        --color-border: #504638;
        --color-accent: #c49a6c;
        --color-surface: #695c41;
    }
}

/* Dark theme — manually selected */
:root[data-theme="dark"] {
    --color-bg: #302b20;
    --color-text: #e9e2d6;
    --color-muted: #b6a994;
    --color-border: #504638;
    --color-accent: #c49a6c;
    --color-surface: #695c41;
}


/* ==================================================
   3. Base Styles
   ================================================== */

/* Global box sizing */
* {
    box-sizing: border-box;
}

/* Main page settings */
body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
}

/* Default image behavior */
img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Images inside the main content area */
main img {
    border-radius: 2px;
}


/* ==================================================
   4. Site Layout
   ================================================== */

/* Shared width and horizontal alignment */
.site-header,
.site-footer,
main {
    width: min(100% - 2rem, var(--content-width));
    margin-inline: auto;
}

/* Main content area */
main {
    padding-block: 3rem 2rem;
}


/* ==================================================
   5. Typography
   ================================================== */

/* Shared heading styles */
h1,
h2,
h3 {
    color: var(--color-text);
    font-family: var(--font-heading);
    line-height: 1.2;
    font-weight: 500;
}

/* Main heading */
h1 {
    margin-top: 0;
    margin-bottom: 1.25rem;
    font-size: clamp(2rem, 4vw, 2.8rem);
}

/* Secondary heading */
h2 {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    font-size: 1.6rem;
}

/* Third-level heading */
h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

/* Bold text */
strong,
b {
    font-weight: 600;
}


/* ==================================================
   6. Header and Navigation
   ================================================== */

/* Shared link styles */
.site-header a,
.site-footer a {
    color: inherit;
    text-decoration: none;
}

/* Site name */
.site-brand {
    margin-bottom: 1rem;
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* Top header row — site name and theme toggle */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 4rem;
    margin-bottom: 5rem;
}

/* Remove default spacing when site name is inside the top row */
.header-top .site-brand {
    margin-bottom: 0;
}

/* Navigation container */
.site-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.75rem;
}

/* Navigation links */
.site-nav a {
    padding-block: 0.25rem;
    border-bottom: 2px solid transparent;
    color: var(--color-muted);
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: color 0.2s ease, border-color 0.2s ease;
}

/* Header and footer hover states */
.site-nav a:hover,
.site-footer a:hover {
    color: var(--color-accent);
    text-decoration: underline;
}

/* Navigation hover indicator */
.site-nav a:hover {
    border-bottom-color: var(--color-accent);
    text-decoration: none;
}


/* ==================================================
   7. Footer
   ================================================== */

.site-footer {
    display: flex;
    justify-content: center;
    margin-top: 6rem;
    padding-block: 2rem;
    border-top: 1px solid var(--color-border);
}

/* Footer link */
.site-footer a {
    color: var(--color-muted);
    font-size: 0.875rem;
    text-align: center;
    text-decoration: none;
    transition: color 0.2s ease;
}

/* Footer hover state */
.site-footer a:hover {
    color: var(--color-accent);
    text-decoration: underline;
}


/* ==================================================
   8. Blog — Article List and Cards
   ================================================== */

/* Article list container */
.article-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    margin-inline: auto;
    margin-top: 2rem;
}

/* Individual article card */
.article-card {
    display: grid;
    grid-template-columns: 400px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;

    padding: 1rem;
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-accent);
    background: var(--color-surface);

    transition: border-color 0.2s ease;
}

/* Highlight card on hover */
.article-card:hover {
    border-color: var(--color-accent);
}

/* Article card link */
.article-card > a {
    display: block;
}

/* Article thumbnail */
.article-card img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

/* Text content inside the card */
.article-card-content {
    min-width: 0;
}

/* Article title */
.article-card h2 {
    margin: 0 0 0.5rem;
    font-size: 1.35rem;
    line-height: 1.3;
}

/* Article description */
.article-card p {
    margin: 0.5rem 0 0;
}

/* Article publication date */
.article-card .article-date {
    color: var(--color-muted);
    font-size: 0.875rem;
}

/* Card links */
.article-card a {
    color: inherit;
    text-decoration: none;
}

/* Article title hover state */
.article-card h2 a:hover {
    color: var(--color-accent);
    text-decoration: underline;
}

/* Article tags — shared styling */


.blog-tags a,
.article-tags a,
.article-tags span {
    margin-top: 0.5rem;
    row-gap: 0.75rem;

    display: inline-block;
    padding: 0.3rem 0.65rem;

    border: 1px solid var(--color-accent);
    border-radius: 3px;

    background: var(--color-surface);
    color: var(--color-accent);

    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;

    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Article tags — hover */
.blog-tags a:hover,
.article-tags a:hover {
    background: var(--color-accent);
    color: var(--color-surface);
    text-decoration: none;
}

.article-content .article-tags a {
    color: var(--color-accent);
    text-decoration: none;
}

.article-content .article-tags a:hover {
    color: var(--color-surface);
    text-decoration: none;
}

.taxonomy-heading {
    margin-bottom: 1.5rem;
}


/* ==================================================
   9. Article — Reading Layout
   ================================================== */

/* Main article container */
.article-content {
    margin-inline: auto;
    padding: 1.5rem;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
}

/* Article heading and date container */
.article-header {
    margin-bottom: 1.5rem;
}

/* Article title */
.article-header h1 {
    margin-bottom: 0.75rem;
}

/* Article section headings */
.article-content h2 {
    margin-top: 2.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--color-border);
}

/* Article subsection headings */
.article-content h3 {
    margin-top: 2rem;
}

/* Article publication date */
.article-date {
    color: var(--color-muted);
    font-size: 0.9rem;
}

/* Article cover image */
.article-cover {
    display: block;
    width: 100%;
    margin: 0 0 2.5rem;
    border: 1px solid var(--color-border);
}

/* Article paragraphs */
.article-content p {
    line-height: 1.8;
    margin-block: 1rem;
}

/* Links inside articles and static pages */
.article-content a,
.page-content a {
    color: var(--color-link);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

/* Article and page link hover state */
.article-content a:hover,
.page-content a:hover {
    color: var(--color-link-hover);
}

/* Article lists */
.article-content ul,
.article-content ol {
    margin-block: 1rem 1.5rem;
    padding-left: 1.75rem;
}

/* Article list items */
.article-content li {
    margin-bottom: 0.5rem;
}


/* ==================================================
   10. Code Blocks and Mermaid Diagrams
   ================================================== */

/* Code block container */
pre {
    padding: 1.25rem;
    border-radius: 6px;
    background-color: #292929;
    overflow-x: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Inline code inside code blocks */
pre code {
    padding: 0;
    white-space: inherit;
    overflow-wrap: inherit;
}

/* Center Mermaid diagrams */
.mermaid {
    display: flex;
    justify-content: center;
    width: 100%;
}

/* Mermaid diagram lines — dark theme */
[data-theme="dark"] .mermaid .edgePaths .path,
[data-theme="dark"] .mermaid .flowchart-link {
    stroke: #c8c0b4;
}

/* Mermaid diagram arrow markers — dark theme */
[data-theme="dark"] .mermaid .marker path {
    fill: #c8c0b4;
    stroke: #c8c0b4;
}


/* ==================================================
   11. Theme Toggle
   ================================================== */

/* Theme toggle button */
.theme-toggle {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 1.25rem;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Theme toggle hover state */
.theme-toggle:hover {
    border-color: var(--color-accent);
    background: var(--color-bg);
}


/* ==================================================
   12. Homepage
   ================================================== */

/* Homepage content alignment */
.home-content {
    text-align: center;
}

/* Homepage image */
.home-content img {
    width: 100%;
    max-width: 600px;
    margin-inline: auto;
}

/* Homepage secondary heading */
.home-content h2 {
    margin-top: 5rem;
    margin-bottom: 5rem;
    font-weight: 400;
    font-size: 1.3rem;
}

/* Homepage paragraphs */
.home-content p {
    max-width: 600px;
    margin: 0 auto 1rem;
    text-align: left;
    font-size: 1.1rem;
    line-height: 1.7;
}

/* Spacing between an image and the following paragraph */
.home-content p:has(img) + p {
    margin-top: 3rem;
}


/* ==================================================
   13. About Page
   ================================================== */

/* About page text alignment */
.about-content {
    text-align: justify;
}

/* First image — floated left */
.about-content p:has(img) img {
    float: left;
    width: 100%;
    max-width: 400px;
    margin: 0 1.5rem 1rem 0;
}

/* Second image — floated right */
.about-content p:has(img) ~ p:has(img) img {
    float: right;
    width: 100%;
    max-width: 400px;
    margin: 0 0 1rem 1.5rem;
}


/* ==================================================
   14. Contact Page
   ================================================== */

/* Contact page content alignment */
.contact-content {
    text-align: center;
}

/* Contact page image */
.contact-content img {
    width: 100%;
    max-width: 600px;
    margin: 4rem auto 0;
}

/* Contact page secondary heading */
.contact-content h2 {
    margin-top: 3rem;
    margin-bottom: 3rem;
}

/* Contact page paragraphs */
.contact-content p {
    max-width: 600px;
    margin: 0 auto 1rem;
    font-size: 1.1rem;
    line-height: 1.7;
}


/* ==================================================
   15. Responsive Styles
   ================================================== */

/* Mobile layout */
@media (max-width: 600px) {

    /* Stack article cards into a narrower two-column layout */
    .article-card {
        grid-template-columns: 120px minmax(0, 1fr);
        gap: 1rem;
    }

    /* Reduce article title size on mobile */
    .article-card h2 {
        font-size: 1.1rem;
    }
}