/*
Theme Name: MinimalAI
Theme URI: https://example.com/minimalai
Author: Your Name
Description: A minimalist, Medium-inspired WordPress theme. Clean typography, focused reading experience, SEO and AI-overview optimized.
Version: 3.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: minimalai
Tags: minimalist, blog, clean, seo, reading
*/

/* ─── Variables ─────────────────────────────────────────────── */
:root {
    --text:        #1a1a1a;
    --muted:       #6b6b6b;
    --subtle:      #999;
    --border:      #e8e8e8;
    --bg:          #ffffff;
    --bg-soft:     #fafafa;
    --serif:       'Playfair Display', Georgia, 'Times New Roman', serif;
    --sans:        'Inter', system-ui, -apple-system, sans-serif;
    --read-width:  680px;
    --wide-width:  860px;
    --site-width:  1160px;
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    font-size: 1.0625rem;
    line-height: 1.75;
    color: var(--text);
    background: var(--bg);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
p   { margin-top: 0; margin-bottom: 1.25rem; }

a {
    color: inherit;
    text-decoration: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--serif);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-top: 0;
    margin-bottom: 0.5em;
}

/* ─── Site Navbar ───────────────────────────────────────────── */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    height: 60px;
    display: flex;
    align-items: center;
}

.site-nav__inner {
    width: 100%;
    max-width: var(--site-width);
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-nav__brand {
    font-family: var(--serif);
    font-size: 1.1875rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
    white-space: nowrap;
}
.site-nav__brand:hover { opacity: 0.7; }

.site-nav__links {
    display: flex;
    align-items: center;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav__links a {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s;
    letter-spacing: 0;
}
.site-nav__links a:hover { color: var(--text); }

.site-nav__links .nav-cta {
    background: var(--text);
    color: #fff;
    padding: 0.4rem 1.1rem;
    border-radius: 999px;
    font-size: 0.875rem;
    transition: opacity 0.2s;
}
.site-nav__links .nav-cta:hover { opacity: 0.8; color: #fff; }

/* Mobile nav toggle */
.site-nav__toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text);
}
.site-nav__toggle svg { display: block; }

@media (max-width: 600px) {
    .site-nav__toggle { display: block; }
    .site-nav__links {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding: 0.5rem 0;
    }
    .site-nav__links.is-open { display: flex; }
    .site-nav__links li { width: 100%; }
    .site-nav__links a {
        display: block;
        padding: 0.75rem 2rem;
        font-size: 1rem;
    }
    .site-nav__links .nav-cta {
        background: none;
        border-radius: 0;
        padding: 0.75rem 2rem;
        color: var(--text);
        font-size: 1rem;
    }
}

/* ─── Front Page ─────────────────────────────────────────────── */
.fp-hero {
    max-width: var(--read-width);
    margin: 0 auto;
    padding: 5rem 2rem 4rem;
    border-bottom: 1px solid var(--border);
}

.fp-hero__title {
    font-size: clamp(2.375rem, 6vw, 3.75rem);
    line-height: 1.1;
    margin-bottom: 1.25rem;
    letter-spacing: -0.03em;
}

.fp-hero__lead {
    font-size: 1.125rem;
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 2rem;
    max-width: 520px;
}

.fp-hero__actions {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.fp-hero__actions a {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 2px;
    transition: color 0.15s, border-color 0.15s;
}
.fp-hero__actions a:hover { color: var(--text); border-color: var(--text); }

/* Front page recent posts */
.fp-section {
    max-width: var(--site-width);
    margin: 0 auto;
    padding: 3.5rem 2rem 6rem;
}

.fp-section__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 2.5rem;
}

.fp-section__label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--subtle);
    margin: 0;
}

.fp-section__more {
    font-size: 0.875rem;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 1px;
    transition: color 0.15s, border-color 0.15s;
}
.fp-section__more:hover { color: var(--text); border-color: var(--text); }

/* 3-col grid */
.fp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem 2.5rem;
}

/* ─── Post Card (front page grid) ──────────────────────────── */
.pc {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.pc__img {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--bg-soft);
}
.pc__img img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.pc:hover .pc__img img { transform: scale(1.04); }

.pc__meta {
    font-size: 0.8rem;
    color: var(--subtle);
    margin: 0;
}

.pc__title {
    font-family: var(--serif);
    font-size: 1.1875rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    color: var(--text);
    transition: opacity 0.15s;
}
.pc:hover .pc__title { opacity: 0.6; }

.pc__excerpt {
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ─── Blog Listing (archive / home) ─────────────────────────── */
.listing-header {
    max-width: var(--read-width);
    margin: 0 auto;
    padding: 5rem 2rem 3rem;
    border-bottom: 1px solid var(--border);
}

.listing-header__title {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
}

.listing-header__desc {
    color: var(--muted);
    margin: 0;
    font-size: 1.0625rem;
}

.listing {
    max-width: var(--read-width);
    margin: 0 auto;
    padding: 0 2rem 6rem;
}

/* Each post row */
.li-post {
    display: grid;
    grid-template-columns: 1fr 120px;
    gap: 1.5rem;
    align-items: start;
    padding: 2.25rem 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
}
.li-post:hover .li-post__title { opacity: 0.6; }

.li-post__meta {
    font-size: 0.8rem;
    color: var(--subtle);
    margin-bottom: 0.5rem;
}

.li-post__title {
    font-family: var(--serif);
    font-size: 1.3125rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 0.5rem;
    transition: opacity 0.15s;
}

.li-post__excerpt {
    font-size: 0.9375rem;
    color: var(--muted);
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.li-post__thumb {
    width: 120px;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background: var(--bg-soft);
    flex-shrink: 0;
}
.li-post__thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.li-post:hover .li-post__thumb img { transform: scale(1.05); }

/* No thumbnail variant */
.li-post--no-thumb { grid-template-columns: 1fr; }

/* Pagination */
.pagination {
    max-width: var(--read-width);
    margin: 0 auto;
    padding: 2rem 2rem 0;
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border-radius: 4px;
    font-size: 0.9375rem;
    color: var(--muted);
    text-decoration: none;
    transition: all 0.15s;
}
.page-numbers:hover,
.page-numbers.current {
    background: var(--text);
    color: #fff;
}

/* ─── Single Post — Medium style ────────────────────────────── */
.article {
    padding-bottom: 6rem;
}

/* Narrow header */
.article__header {
    max-width: var(--read-width);
    margin: 0 auto;
    padding: 4rem 2rem 2rem;
}

.article__back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    color: var(--muted);
    margin-bottom: 2rem;
    transition: color 0.15s;
}
.article__back:hover { color: var(--text); }
.article__back svg { flex-shrink: 0; }

.article__title {
    font-size: clamp(2rem, 5vw, 2.875rem);
    line-height: 1.15;
    letter-spacing: -0.025em;
    margin-bottom: 1.75rem;
}

.article__meta {
    font-size: 0.875rem;
    color: var(--subtle);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
}
.article__meta-sep { color: var(--border); }

/* Featured image — slightly wider than reading column */
.article__featured {
    max-width: var(--wide-width);
    margin: 2.5rem auto 3rem;
    padding: 0 2rem;
}
.article__featured img {
    width: 100%;
    height: auto;
    display: block;
}
.article__featured figcaption {
    text-align: center;
    font-size: 0.875rem;
    color: var(--subtle);
    margin-top: 0.75rem;
    font-style: italic;
    line-height: 1.5;
}

/* Reading body */
.article__body {
    max-width: var(--read-width);
    margin: 0 auto;
    padding: 0 2rem;
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text);
}

.article__body p { margin-bottom: 1.5rem; }

.article__body h2 {
    font-size: 1.625rem;
    margin-top: 2.75rem;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}
.article__body h3 {
    font-size: 1.3125rem;
    margin-top: 2.25rem;
    margin-bottom: 0.625rem;
}
.article__body h4 {
    font-size: 1.125rem;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}

/* Links inside content */
.article__body a {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--border);
    transition: text-decoration-color 0.15s;
}
.article__body a:hover { text-decoration-color: var(--text); }

/* Lists */
.article__body ul,
.article__body ol {
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
}
.article__body li { margin-bottom: 0.4rem; }

/* Images inside content */
.article__body img {
    width: 100%;
    height: auto;
    display: block;
    margin: 2.5rem 0;
}
.article__body figure { margin: 2.5rem 0; }
.article__body figure img { margin: 0 0 0.75rem; }
.article__body figcaption {
    text-align: center;
    font-size: 0.875rem;
    color: var(--subtle);
    font-style: italic;
}

/* Blockquote — elegant, like Medium */
.article__body blockquote {
    margin: 2.5rem 0;
    padding-left: 1.5rem;
    border-left: 3px solid var(--text);
    font-family: var(--serif);
    font-size: 1.375rem;
    font-style: italic;
    line-height: 1.55;
    color: var(--text);
}
.article__body blockquote p:last-child { margin-bottom: 0; }

/* Divider — Medium's "· · ·" separator */
.article__body hr {
    border: none;
    text-align: center;
    margin: 3rem 0;
    overflow: visible;
}
.article__body hr::after {
    content: "· · ·";
    font-size: 1.25rem;
    letter-spacing: 0.6em;
    color: var(--muted);
}

/* Code */
.article__body pre {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.65;
    margin: 2rem 0;
    border-radius: 2px;
}
.article__body code {
    font-size: 0.875em;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    padding: 0.1em 0.4em;
    border-radius: 2px;
}
.article__body pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
}

/* ─── Article Footer (tags + prev/next) ─────────────────────── */
.article__footer {
    max-width: var(--read-width);
    margin: 3.5rem auto 0;
    padding: 2.5rem 2rem 0;
    border-top: 1px solid var(--border);
}

.article__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0;
}
.article__tag {
    font-size: 0.875rem;
    color: var(--muted);
    padding: 0.3rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: all 0.15s;
}
.article__tag:hover { color: var(--text); border-color: var(--text); }

/* Prev / Next navigation */
.post-nav {
    max-width: var(--read-width);
    margin: 2.5rem auto 0;
    padding: 2.5rem 2rem 0;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}
.post-nav__item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    text-decoration: none;
    color: inherit;
}
.post-nav__item--next { text-align: right; }
.post-nav__label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--subtle);
}
.post-nav__title {
    font-family: var(--serif);
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.3;
    transition: opacity 0.15s;
}
.post-nav__item:hover .post-nav__title { opacity: 0.55; }

/* ─── Static Page ────────────────────────────────────────────── */
.page-body {
    max-width: var(--read-width);
    margin: 0 auto;
    padding: 4.5rem 2rem 6rem;
}
.page-body__title {
    font-size: clamp(2rem, 5vw, 2.875rem);
    margin-bottom: 2rem;
    letter-spacing: -0.025em;
}
.page-body__content { font-size: 1.125rem; line-height: 1.8; }
.page-body__content a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.page-body__content img { margin: 2rem 0; }
.page-body__content blockquote {
    margin: 2rem 0;
    padding-left: 1.5rem;
    border-left: 3px solid var(--text);
    font-family: var(--serif);
    font-size: 1.25rem;
    font-style: italic;
}

/* ─── Footer ─────────────────────────────────────────────────── */
.site-footer {
    background: #111;
    padding: 2.5rem 2rem;
}
.site-footer__inner {
    max-width: var(--site-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}
.site-footer p { margin: 0; font-size: 0.875rem; color: rgba(255,255,255,0.4); }
.site-footer a { color: rgba(255,255,255,0.4); text-decoration: none; transition: color 0.15s; }
.site-footer a:hover { color: #fff; }
.site-footer__links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0; padding: 0;
}
.site-footer__links a { font-size: 0.875rem; }

/* ─── 404 ────────────────────────────────────────────────────── */
.not-found {
    max-width: var(--read-width);
    margin: 0 auto;
    padding: 7rem 2rem;
    text-align: center;
}
.not-found__code {
    font-family: var(--serif);
    font-size: 7rem;
    font-weight: 700;
    line-height: 1;
    color: var(--border);
    margin-bottom: 1rem;
}
.not-found__title { font-size: 1.5rem; margin-bottom: 1rem; }
.not-found__text { color: var(--muted); margin-bottom: 2rem; }
.btn-back {
    display: inline-block;
    padding: 0.65rem 1.5rem;
    background: var(--text);
    color: #fff;
    border-radius: 4px;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: opacity 0.2s;
}
.btn-back:hover { opacity: 0.8; color: #fff; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
    .fp-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .fp-grid { grid-template-columns: 1fr; gap: 2.5rem; }
    .li-post { grid-template-columns: 1fr; }
    .li-post__thumb { width: 100%; aspect-ratio: 16/9; }
    .post-nav { grid-template-columns: 1fr; }
    .post-nav__item--next { text-align: left; }
    .fp-hero { padding: 3.5rem 1.5rem 3rem; }
    .listing-header { padding: 3.5rem 1.5rem 2.5rem; }
    .listing { padding: 0 1.5rem 5rem; }
    .article__header { padding: 3rem 1.5rem 1.5rem; }
    .article__body { padding: 0 1.5rem; }
    .article__featured { padding: 0 1.5rem; }
    .article__footer { padding: 2rem 1.5rem 0; }
    .post-nav { padding: 2rem 1.5rem 0; }
    .page-body { padding: 3rem 1.5rem 5rem; }
    .fp-section { padding: 3rem 1.5rem 5rem; }
}
