/*
Theme Name: Aithor
Theme URI: https://aithor.ca
Author: Aithor
Author URI: https://aithor.ca
Description: A modern, minimalist blog theme matching the Aithor Django frontend design. Customizable colors, fonts and logo.
Version: 3.0.1
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: aithor
Tags: blog, one-column, custom-colors, featured-images

Aithor Theme - Your Blog on Autopilot
*/

/* ==========================================================================
   Fonts
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ==========================================================================
   CSS Variables — names kept so plugin color customization keeps working.
   The Aithor plugin injects a <style> on subsites overriding:
   --aithor-primary-color / --aithor-secondary-color / --aithor-accent-color /
   --aithor-text-color / --aithor-bg-color  + body/a/button/h* selectors.
   ========================================================================== */
:root {
    /* Customizable (overridden per blog) */
    --aithor-primary-color: #FFC222;
    --aithor-secondary-color: #b8860b;
    --aithor-accent-color: #FFC222;
    --aithor-text-color: #16171a;
    --aithor-bg-color: #ffffff;

    /* Fonts (customizable) */
    --aithor-font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --aithor-font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Neutral system */
    --aithor-card-bg: #ffffff;
    --aithor-muted: #6b7280;
    --aithor-border-color: #ececec;
    --aithor-surface: #f7f7f8;

    /* Geometry */
    --aithor-radius: 18px;
    --aithor-radius-sm: 12px;
    --aithor-radius-pill: 100px;
    --aithor-shadow: 0 1px 2px rgba(16,17,26,.04), 0 8px 28px rgba(16,17,26,.06);
    --aithor-shadow-hover: 0 4px 10px rgba(16,17,26,.06), 0 18px 48px rgba(16,17,26,.10);

    --aithor-max-width: 1120px;
    --aithor-content-width: 720px;

    --aithor-space-sm: .75rem;
    --aithor-space-md: 1.25rem;
    --aithor-space-lg: 2rem;
    --aithor-space-xl: 3.5rem;
}

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

html {
    scroll-behavior: smooth; -webkit-text-size-adjust: 100%;
    /* Scrollbar follows the blog's own text color (customizable), not the brand yellow */
    scrollbar-color: var(--aithor-text-color) transparent; scrollbar-width: thin;
}
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--aithor-text-color); border-radius: 100px; opacity: .85; }
::-webkit-scrollbar-thumb:hover { background: var(--aithor-text-color); opacity: 1; }

body {
    margin: 0;
    font-family: var(--aithor-font-body);
    color: var(--aithor-text-color);
    background-color: var(--aithor-bg-color);
    line-height: 1.7;
    font-size: 1.05rem;
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

a {
    color: var(--aithor-primary-color);
    text-decoration: none;
    transition: color .15s ease, opacity .15s ease;
}
a:hover { color: var(--aithor-secondary-color); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--aithor-font-heading);
    color: var(--aithor-text-color);
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin: 0 0 var(--aithor-space-md);
    font-weight: 800;
}
h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 900; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.35rem; }
p { margin: 0 0 var(--aithor-space-md); }

::selection { background: var(--aithor-primary-color); color: #000; }

/* ==========================================================================
   Layout
   ========================================================================== */
.site-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.site-container { width: 100%; max-width: var(--aithor-max-width); margin: 0 auto; padding: 0 24px; }
.site-main { flex: 1; padding: var(--aithor-space-xl) 0; }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255,255,255,0.85);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--aithor-border-color);
}
.site-header .site-container {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 18px; padding-bottom: 18px;
}
.site-logo {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--aithor-font-heading);
    font-weight: 900; font-size: 1.4rem; color: var(--aithor-text-color);
    letter-spacing: -0.03em;
}
.site-logo:hover { color: var(--aithor-text-color); opacity: .8; }
.site-logo-icon { color: var(--aithor-primary-color); }
.site-logo-image { max-height: 40px; width: auto; }
.site-nav { display: flex; align-items: center; gap: 22px; }
.site-nav a {
    color: var(--aithor-text-color); font-weight: 600; font-size: .95rem;
    opacity: .8;
}
.site-nav a:hover { opacity: 1; color: var(--aithor-text-color); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn,
.wp-block-button__link,
button,
input[type='submit'],
input[type='button'] {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--aithor-font-body); font-weight: 700; font-size: .95rem;
    padding: 12px 24px; border-radius: var(--aithor-radius-pill);
    background: var(--aithor-primary-color); color: #000;
    border: none; cursor: pointer; text-decoration: none;
    transition: transform .12s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn:hover,
.wp-block-button__link:hover,
button:hover,
input[type='submit']:hover,
input[type='button']:hover {
    color: #000; opacity: .9; transform: translateY(-1px);
}

/* ==========================================================================
   Home intro / blog cards (main site)
   ========================================================================== */
.home-intro { text-align: center; max-width: 680px; margin: 0 auto var(--aithor-space-xl); }
.home-intro h1 { margin-bottom: var(--aithor-space-sm); }
.home-intro p { color: var(--aithor-muted); font-size: 1.15rem; }

.blog-cards {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 22px;
}
.blog-card {
    background: var(--aithor-card-bg);
    border: 1px solid var(--aithor-border-color);
    border-radius: var(--aithor-radius);
    padding: 28px;
    box-shadow: var(--aithor-shadow);
    transition: transform .2s ease, box-shadow .2s ease;
}
.blog-card:hover { transform: translateY(-3px); box-shadow: var(--aithor-shadow-hover); }
.blog-card h2 { font-size: 1.4rem; margin-bottom: 8px; }
.blog-description { color: var(--aithor-muted); margin-bottom: var(--aithor-space-sm); }

/* ==========================================================================
   Blog header + search (subsite list)
   ========================================================================== */
.blog-header { text-align: center; max-width: 720px; margin: 0 auto var(--aithor-space-xl); }
.blog-header h1 { margin-bottom: var(--aithor-space-sm); }
.blog-header p { color: var(--aithor-muted); font-size: 1.15rem; margin-bottom: var(--aithor-space-lg); }

.search-form { display: flex; gap: 10px; max-width: 460px; margin: 0 auto; }
.search-form input[type='search'] {
    flex: 1; padding: 13px 18px;
    border: 1px solid var(--aithor-border-color); border-radius: var(--aithor-radius-pill);
    font-family: var(--aithor-font-body); font-size: .95rem; background: var(--aithor-surface);
    color: var(--aithor-text-color);
}
.search-form input[type='search']:focus {
    outline: none; border-color: var(--aithor-primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--aithor-primary-color) 25%, transparent);
    background: #fff;
}

/* ==========================================================================
   Article list (cards)
   ========================================================================== */
.article-list {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 28px;
    max-width: var(--aithor-max-width); margin: 0 auto;
}
.article-card {
    background: var(--aithor-card-bg);
    border: 1px solid var(--aithor-border-color);
    border-radius: var(--aithor-radius);
    overflow: hidden;
    box-shadow: var(--aithor-shadow);
    transition: transform .2s ease, box-shadow .2s ease;
    display: flex; flex-direction: column;
}
.article-card:hover { transform: translateY(-4px); box-shadow: var(--aithor-shadow-hover); }
.article-thumbnail { aspect-ratio: 16 / 9; background: var(--aithor-surface); overflow: hidden; }
.article-thumbnail img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.article-card:hover .article-thumbnail img { transform: scale(1.04); }
.article-thumbnail:empty { display: none; }

/* Creative placeholder (no image) */
.article-placeholder {
    position: relative; width: 100%; height: 100%; min-height: 180px;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
    background:
        radial-gradient(circle at 1px 1px, rgba(0,0,0,.05) 1px, transparent 0) 0 0 / 20px 20px,
        linear-gradient(135deg, hsl(var(--ph-hue, 45) 80% 93%), hsl(calc(var(--ph-hue, 45) + 45) 72% 85%));
}
.article-placeholder .ph-initial {
    font-family: var(--aithor-font-heading); font-weight: 900;
    font-size: clamp(3rem, 9vw, 5.5rem); line-height: 1;
    color: hsl(var(--ph-hue, 45) 48% 40%); opacity: .55; user-select: none;
}
.article-placeholder .ph-spark { position: absolute; top: 12px; right: 14px; font-size: 1.1rem; opacity: .9; }
.article-featured-image .article-placeholder.is-featured { aspect-ratio: 2 / 1; min-height: 260px; }
.article-content { padding: 22px 24px 26px; display: flex; flex-direction: column; gap: 10px; }
.article-content h2 { font-size: 1.3rem; margin: 0; line-height: 1.25; }
.article-content h2 a { color: var(--aithor-text-color); }
.article-content h2 a:hover { color: var(--aithor-primary-color); }
.article-excerpt { color: var(--aithor-muted); font-size: .98rem; margin: 0; }

.article-meta {
    display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px;
    color: var(--aithor-muted); font-size: .82rem; font-weight: 500;
}

/* ==========================================================================
   Single article
   ========================================================================== */
.single-article { max-width: var(--aithor-content-width); margin: 0 auto; }
.article-header { text-align: center; margin-bottom: var(--aithor-space-lg); }
.article-header h1 { margin-bottom: var(--aithor-space-md); }
.article-header .article-meta { justify-content: center; font-size: .9rem; }

.article-featured-image {
    margin: 0 auto var(--aithor-space-xl);
    border-radius: var(--aithor-radius); overflow: hidden;
    box-shadow: var(--aithor-shadow);
}
.article-featured-image img { width: 100%; }

/* Prose */
.article-body { font-size: 1.12rem; line-height: 1.8; }
.article-body > * { margin-bottom: 1.4rem; }
.article-body h2 { margin-top: 2.6rem; font-size: 1.7rem; }
.article-body h3 { margin-top: 2rem; font-size: 1.3rem; }
.article-body a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.article-body ul, .article-body ol { padding-left: 1.4rem; }
.article-body li { margin-bottom: .5rem; }
.article-body img { border-radius: var(--aithor-radius-sm); margin: 2rem auto; box-shadow: var(--aithor-shadow); }
.article-body blockquote {
    margin: 2rem 0; padding: .5rem 0 .5rem 1.5rem;
    border-left: 4px solid var(--aithor-primary-color);
    font-size: 1.2rem; font-style: italic; color: var(--aithor-text-color);
}
.article-body code {
    background: var(--aithor-surface); padding: .15em .4em; border-radius: 6px;
    font-size: .9em; font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
}
.article-body pre {
    background: #16171a; color: #f4f4f5; padding: 20px 22px;
    border-radius: var(--aithor-radius-sm); overflow-x: auto; font-size: .92rem; line-height: 1.6;
}
.article-body pre code { background: none; padding: 0; color: inherit; }
.article-body hr { border: none; border-top: 1px solid var(--aithor-border-color); margin: 2.5rem 0; }

/* Footer of article: categories / tags */
.article-footer { margin-top: var(--aithor-space-xl); padding-top: var(--aithor-space-lg); border-top: 1px solid var(--aithor-border-color); }
.article-categories, .article-tags { font-size: .92rem; color: var(--aithor-muted); }
.article-categories strong, .article-tags strong { color: var(--aithor-text-color); margin-right: 6px; }
.article-categories a, .article-tags a {
    display: inline-block; border-radius: var(--aithor-radius-pill);
    padding: 4px 14px; margin: 3px 4px 3px 0; font-weight: 600; font-size: .85rem;
    /* Tie chip fill + text to the primary hue so contrast holds regardless of
       the blog's surface/text colors (avoids light text on a light pill). */
    background: var(--aithor-surface);
    background: color-mix(in srgb, var(--aithor-primary-color) 12%, transparent);
    border: 1px solid var(--aithor-primary-color);
    border-color: color-mix(in srgb, var(--aithor-primary-color) 35%, transparent);
    color: var(--aithor-primary-color);
}
.article-categories a:hover, .article-tags a:hover {
    background: color-mix(in srgb, var(--aithor-primary-color) 22%, transparent);
    border-color: var(--aithor-primary-color); color: var(--aithor-primary-color);
}

/* ==========================================================================
   Related posts
   ========================================================================== */
.related-posts { max-width: var(--aithor-content-width); margin: var(--aithor-space-xl) auto 0; }
.related-posts h3 { font-size: 1.4rem; margin-bottom: var(--aithor-space-lg); }
.related-posts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.related-post-card {
    background: var(--aithor-card-bg); border: 1px solid var(--aithor-border-color);
    border-radius: var(--aithor-radius-sm); overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}
.related-post-card:hover { transform: translateY(-3px); box-shadow: var(--aithor-shadow-hover); }
.related-post-thumbnail { aspect-ratio: 16 / 9; background: var(--aithor-surface); overflow: hidden; }
.related-post-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.related-post-card h4 { font-size: 1rem; margin: 0; padding: 14px 16px 4px; line-height: 1.3; }
.related-post-card h4 a { color: var(--aithor-text-color); }
.related-post-card h4 a:hover { color: var(--aithor-primary-color); }
.related-post-card .article-meta { padding: 0 16px 16px; }

/* ==========================================================================
   Pagination
   ========================================================================== */
.aithor-pagination, .pagination, .nav-links {
    display: flex; justify-content: center; flex-wrap: wrap; gap: 8px;
    margin-top: var(--aithor-space-xl);
}
.aithor-pagination a, .aithor-pagination span,
.page-numbers {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 42px; height: 42px; padding: 0 12px;
    border: 1px solid var(--aithor-border-color); border-radius: var(--aithor-radius-sm);
    color: var(--aithor-text-color); font-weight: 700; background: #fff;
}
.page-numbers.current, .aithor-pagination .current {
    background: var(--aithor-primary-color); border-color: var(--aithor-primary-color); color: #000;
}
.page-numbers:hover { border-color: var(--aithor-primary-color); color: var(--aithor-primary-color); }

/* ==========================================================================
   Empty state
   ========================================================================== */
.empty-state {
    text-align: center; color: var(--aithor-muted);
    padding: var(--aithor-space-xl); border: 1px dashed var(--aithor-border-color);
    border-radius: var(--aithor-radius); background: var(--aithor-surface);
    max-width: 560px; margin: 0 auto;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    border-top: 1px solid var(--aithor-border-color);
    padding: var(--aithor-space-lg) 0;
    text-align: center;
}
.site-footer p { margin: 4px 0; color: var(--aithor-muted); font-size: .9rem; }
.site-footer a { font-weight: 600; }

/* ==========================================================================
   Utilities
   ========================================================================== */
.mt-lg { margin-top: var(--aithor-space-lg); }
.aligncenter { margin-left: auto; margin-right: auto; }
.alignleft { float: left; margin: 0 1.5rem 1rem 0; }
.alignright { float: right; margin: 0 0 1rem 1.5rem; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    body { font-size: 1rem; }
    .site-main { padding: var(--aithor-space-lg) 0; }
    .article-list { grid-template-columns: 1fr; }
    .related-posts-grid { grid-template-columns: 1fr; }
    .article-body { font-size: 1.05rem; }
    .site-nav { gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
}
