/* ============================================================
   ChocolateMoo53 — Custom theme based on mnml aesthetic
   Font: Gabarito (loaded as Metropolis)
   Colors: #C84F22 primary, #C2552C secondary
   ============================================================ */

/* --- Font --- */
@font-face {
    font-family: "Gabarito";
    src: url("https://cdn.staticdelivr.com/gh/naipefoundry/gabarito/refs/heads/main/fonts/webfonts/Gabarito%5Bwght%5D.woff2") format("woff2");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

/* --- Design tokens --- */
:root {
    --font: "Gabarito", system-ui, sans-serif;
    --font-size: 18px;
    --line-height: 1.7;
    --content-width: 680px;
    --header-width: 900px;

    /* Brand */
    --color-accent: #C84F22;
    --color-accent-dark: #a03d18;

    /* Light mode defaults */
    --color-bg: #ffffff;
    --color-text: #1a1a1a;
    --color-text-muted: #555555;
    --color-border: #e0e0e0;
    --color-link: #C84F22;
    --color-link-hover: #a03d18;
    --color-code-bg: #fff4eb;
    --color-header-bg: #ffffff;
    --color-nav-link: #444444;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #0f0f0f;
        --color-text: #f0f0f0;
        --color-text-muted: #aaaaaa;
        --color-border: #2a2a2a;
        --color-link: #e0784a;
        --color-link-hover: #f5a07a;
        --color-code-bg: #1e1e1e;
        --color-header-bg: #0f0f0f;
        --color-nav-link: #cccccc;
    }
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: var(--font-size);
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    font-size: 1rem;
    line-height: var(--line-height);
    color: var(--color-text);
    background-color: var(--color-bg);
    margin: 0;
    padding: 0;
}

/* --- Accessibility --- */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    background: var(--color-accent);
    color: #fff;
    padding: 8px 16px;
    z-index: 1000;
    font-size: 0.9rem;
}

.skip-link:focus {
    left: 8px;
    top: 8px;
}

*:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* --- Layout shells --- */
.site-header {
    background-color: var(--color-header-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 1.5rem 1.25rem;
}

.site-header-inner {
    max-width: var(--header-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.site-main {
    padding: 2.5rem 1.25rem 3rem;
}

.site-content {
    max-width: var(--content-width);
    margin: 0 auto;
}

.site-footer {
    padding: 2rem 1.25rem 3rem;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

/* --- Site branding --- */
.site-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
    letter-spacing: -0.01em;
}

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

/* --- Site nav --- */
.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.site-nav li {
    margin: 0;
    padding: 0;
}

.site-nav a {
    color: var(--color-nav-link);
    text-decoration: none;
    font-size: 0.95rem;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
    color: var(--color-accent);
}

.site-nav a[aria-current="page"] {
    font-weight: 600;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font);
    font-weight: 700;
    line-height: 1.3;
    color: var(--color-text);
    margin-top: 2rem;
    margin-bottom: 0.6rem;
}

h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; color: var(--color-text-muted); }

p {
    margin-top: 0;
    margin-bottom: 1.2rem;
    color: var(--color-text);
}

a {
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--color-link-hover);
}

strong { font-weight: 700; }
em { font-style: italic; }

/* --- Post list --- */
.page-title {
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 2rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.page-content {
    margin-bottom: 2.5rem;
}

.posts-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.post-entry {
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
}

.post-entry:last-child {
    border-bottom: none;
}

.post-meta {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0.3rem;
}

.post-meta time {
    color: var(--color-text-muted);
}

.post-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.post-title a {
    color: var(--color-text);
    text-decoration: none;
}

.post-title a:hover {
    color: var(--color-accent);
}

.post-summary {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* --- Single post --- */
.post-header {
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.post-header .post-title {
    font-size: 1.75rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.post-content {
    /* inherits body styles */
}

.post-content p:last-child {
    margin-bottom: 0;
}

/* --- Blockquotes --- */
blockquote {
    border-left: 3px solid var(--color-accent);
    margin: 1.5rem 0;
    padding: 0.5rem 0 0.5rem 1.25rem;
    color: var(--color-text-muted);
    font-style: italic;
}

blockquote p:last-child {
    margin-bottom: 0;
}

/* --- Code --- */
code {
    font-family: "Menlo", "Monaco", "Courier New", monospace;
    font-size: 0.875em;
    background-color: var(--color-code-bg);
    padding: 0.15em 0.35em;
    border-radius: 3px;
    color: var(--color-text);
}

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

pre code {
    background: none;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.6;
}

/* --- Lists --- */
ul, ol {
    margin: 0 0 1.2rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.3rem;
}

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

.img-responsive {
    max-width: 100%;
    height: auto;
}

figure {
    margin: 1.5rem 0;
}

figcaption {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-align: center;
    margin-top: 0.5rem;
    font-style: italic;
}

/* --- Tables --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

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

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

/* --- Horizontal rule --- */
hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2rem 0;
}

/* --- Footer --- */
.footer-inner {
    line-height: 1.6;
}

.footer-inner a {
    color: var(--color-text-muted);
}

.footer-inner a:hover {
    color: var(--color-accent);
}

/* --- Mobile --- */
@media (max-width: 600px) {
    html {
        font-size: 16px;
    }

    .site-header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .site-nav ul {
        gap: 1rem;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }

    .post-header .post-title {
        font-size: 1.4rem;
    }
}

/* --- Photo grid --- */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin: 1.25rem 0 2rem;
}

.image-grid-item {
    display: block;
    overflow: hidden;
    border-radius: 3px;
}

.image-grid-item img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s ease;
}

.image-grid-item:hover img {
    opacity: 0.85;
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 1ms !important;
        transition-duration: 1ms !important;
    }
}
