/*
Theme Name: Flavor MFG
Theme URI: https://mfgguides.com
Author: Flavor Dev
Author URI: https://mfgguides.com
Description: Dark + Orange manufacturing excellence theme for MFG Guides blog.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: flavor-mfg
*/

/* ========== RESET & BASE ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-header: #1a2332;
    --color-accent: #e67e22;
    --color-accent-hover: #d35400;
    --color-hero-dark: #111827;
    --color-body-bg: #f0f2f5;
    --color-card-bg: #ffffff;
    --color-footer-bg: #0f1923;
    --color-text: #374151;
    --color-text-light: #6b7280;
    --color-heading: #1f2937;
    --color-border: #e5e7eb;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: 'Outfit', 'Inter', sans-serif;
    --max-width: 1200px;
    --radius: 12px;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
    --shadow-card-hover: 0 8px 30px rgba(0,0,0,0.10);
    --transition: 0.25s ease;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--color-body-bg);
    color: var(--color-text);
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-accent-hover); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--color-heading);
    line-height: 1.3;
    font-weight: 700;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

/* ========== READING PROGRESS BAR ========== */
#reading-progress {
    position: fixed; top: 0; left: 0; width: 0; height: 3px;
    background: linear-gradient(90deg, #e67e22, #f39c12, #e67e22);
    z-index: 10000; transition: width 0.1s linear;
    box-shadow: 0 0 8px rgba(230,126,34,0.5);
}

/* ========== HEADER ========== */
.site-header {
    background: var(--color-header);
    position: sticky; top: 0; z-index: 9999;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.site-header.header-hidden { transform: translateY(-100%); }

.header-inner {
    max-width: var(--max-width); margin: 0 auto; padding: 0 24px;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
    height: 68px;
}
.header-inner::after { content: ''; }

.site-logo {
    font-family: var(--font-heading);
    font-size: 1.5rem; font-weight: 800;
    color: #ffffff; display: flex; align-items: center; gap: 8px;
}
.site-logo .logo-icon { font-size: 1.6rem; }
.site-logo a { color: #ffffff; }
.site-logo a:hover { color: var(--color-accent); }

.main-nav ul {
    list-style: none; display: flex; gap: 8px; align-items: center;
}
.main-nav a {
    color: rgba(255,255,255,0.75);
    font-size: 0.8rem; font-weight: 600;
    letter-spacing: 0.1em; text-transform: uppercase;
    padding: 8px 16px; border-radius: 6px;
    transition: all var(--transition);
}
.main-nav a:hover,
.main-nav .current-menu-item a,
.main-nav .current_page_item a {
    color: var(--color-accent);
    background: rgba(230,126,34,0.1);
}

/* Hamburger */
.hamburger {
    display: none; background: none; border: none; cursor: pointer;
    flex-direction: column; gap: 5px; padding: 8px;
}
.hamburger span {
    display: block; width: 24px; height: 2px;
    background: #ffffff; border-radius: 2px;
    transition: all 0.3s ease;
}
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

@media (max-width: 768px) {
    .hamburger { display: flex; }
    .main-nav {
        display: none; position: absolute; top: 68px; left: 0; right: 0;
        background: var(--color-header); padding: 16px 24px;
        border-top: 1px solid rgba(255,255,255,0.1);
        box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    }
    .main-nav.nav-open { display: block; }
    .main-nav ul { flex-direction: column; gap: 4px; }
    .main-nav a { display: block; padding: 12px 16px; border-radius: 8px; }
}

/* ========== HOMEPAGE HERO ========== */
.homepage-hero {
    background: linear-gradient(135deg, #111827 0%, #1a2332 50%, #111827 100%);
    padding: 80px 0 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.homepage-hero::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(230,126,34,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.hero-badge {
    display: inline-block;
    background: linear-gradient(135deg, rgba(230,126,34,0.2), rgba(230,126,34,0.1));
    border: 1px solid rgba(230,126,34,0.3);
    color: var(--color-accent);
    font-size: 0.75rem; font-weight: 700;
    letter-spacing: 0.15em; text-transform: uppercase;
    padding: 8px 20px; border-radius: 50px;
    margin-bottom: 24px;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 800; color: #ffffff;
    line-height: 1.15; margin-bottom: 20px;
    max-width: 700px; margin-left: auto; margin-right: auto;
}
.hero-title .highlight {
    color: var(--color-accent);
    position: relative;
}

.hero-subtitle {
    color: rgba(255,255,255,0.6);
    font-size: 1.1rem; max-width: 550px;
    margin: 0 auto 32px; line-height: 1.6;
}

.hero-line {
    width: 120px; height: 3px; margin: 0 auto;
    background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
    border-radius: 2px;
    animation: heroLinePulse 3s ease-in-out infinite;
}
@keyframes heroLinePulse {
    0%, 100% { opacity: 0.5; width: 120px; }
    50% { opacity: 1; width: 180px; }
}

/* ========== SECTION HEADING ========== */
.section-heading {
    text-align: center; margin: 48px 0 32px;
}
.section-heading h2 {
    font-size: 1.6rem; color: var(--color-heading);
    display: inline-flex; align-items: center; gap: 12px;
}
.section-heading h2::before,
.section-heading h2::after {
    content: ''; width: 40px; height: 2px;
    background: var(--color-accent); border-radius: 2px;
}

/* ========== GEAR DIVIDER ========== */
.gear-divider {
    text-align: center; padding: 32px 0; color: var(--color-accent);
    font-size: 1.2rem; letter-spacing: 0.5em;
    opacity: 0.5;
}

/* ========== CARD GRID ========== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 28px; padding: 0 0 48px;
}

.post-card {
    background: var(--color-card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex; flex-direction: column;
}
.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}

.post-card__image {
    position: relative; overflow: hidden;
    aspect-ratio: 16/10;
}
.post-card__image img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.4s ease;
}
.post-card:hover .post-card__image img { transform: scale(1.05); }

.post-card__image-placeholder {
    width: 100%; height: 100%;
    background: linear-gradient(135deg, #1a2332 0%, #2d3748 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem; color: var(--color-accent); opacity: 0.4;
}

.post-card__badge {
    position: absolute; top: 12px; left: 12px;
    background: var(--color-accent); color: #ffffff;
    font-size: 0.65rem; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase;
    padding: 4px 10px; border-radius: 4px;
}

.post-card__body { padding: 20px; flex: 1; display: flex; flex-direction: column; }

.post-card__meta {
    display: flex; align-items: center; gap: 12px;
    font-size: 0.8rem; color: var(--color-text-light);
    margin-bottom: 10px;
}
.post-card__meta .reading-time { color: var(--color-accent); font-weight: 600; }

.post-card__title {
    font-family: var(--font-heading);
    font-size: 1.15rem; font-weight: 700;
    line-height: 1.4; margin-bottom: 10px;
}
.post-card__title a { color: var(--color-heading); }
.post-card__title a:hover { color: var(--color-accent); }

.post-card__excerpt {
    font-size: 0.9rem; color: var(--color-text-light);
    line-height: 1.6; flex: 1;
    display: -webkit-box; -webkit-line-clamp: 3;
    -webkit-box-orient: vertical; overflow: hidden;
}

.post-card__footer {
    padding: 16px 20px; border-top: 1px solid var(--color-border);
    display: flex; align-items: center; justify-content: space-between;
}
.post-card__read-more {
    font-size: 0.8rem; font-weight: 600; color: var(--color-accent);
    text-transform: uppercase; letter-spacing: 0.05em;
}
.post-card__read-more:hover { color: var(--color-accent-hover); }

/* ========== AD ZONE ========== */
.ad-zone {
    background: var(--color-card-bg);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 24px; margin: 32px 0;
    text-align: center; min-height: 100px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; color: var(--color-text-light);
}

/* ========== ARTICLE HERO ========== */
.article-hero {
    position: relative; min-height: 400px;
    display: flex; align-items: flex-end;
    background: var(--color-hero-dark);
    overflow: hidden;
}
.article-hero__bg {
    position: absolute; inset: 0;
}
.article-hero__bg img {
    width: 100%; height: 100%; object-fit: cover;
    opacity: 0.4;
}
.article-hero__overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(17,24,39,0.95) 0%, rgba(17,24,39,0.4) 100%);
}
.article-hero__content {
    position: relative; z-index: 2;
    max-width: var(--max-width); margin: 0 auto;
    padding: 60px 24px 48px; width: 100%;
}
.article-hero__badge {
    display: inline-block;
    background: var(--color-accent); color: #ffffff;
    font-size: 0.7rem; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase;
    padding: 5px 14px; border-radius: 4px;
    margin-bottom: 16px;
}
.article-hero__title {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800; color: #ffffff;
    line-height: 1.2; margin-bottom: 16px; max-width: 800px;
}
.article-hero__meta {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    font-size: 0.85rem; color: rgba(255,255,255,0.65);
}
.article-hero__meta .sep { opacity: 0.3; }

/* ========== BREADCRUMBS ========== */
.breadcrumbs {
    padding: 16px 0; font-size: 0.8rem; color: var(--color-text-light);
}
.breadcrumbs a { color: var(--color-accent); }
.breadcrumbs .sep { margin: 0 8px; opacity: 0.4; }

/* ========== ARTICLE CONTENT ========== */
.article-layout {
    max-width: 800px; margin: 0 auto; padding: 0 24px 60px;
}

.article-content {
    background: var(--color-card-bg);
    border-radius: var(--radius);
    padding: 48px; margin-bottom: 32px;
    box-shadow: var(--shadow-card);
}

.article-content h2 {
    font-size: 1.6rem; margin: 40px 0 16px;
    padding-top: 32px; border-top: 2px solid var(--color-border);
    color: var(--color-heading);
}
.article-content h2:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.article-content h3 { font-size: 1.3rem; margin: 32px 0 12px; }
.article-content p { margin-bottom: 18px; }
.article-content ul, .article-content ol { margin: 0 0 18px 24px; }
.article-content li { margin-bottom: 8px; }
.article-content blockquote {
    border-left: 4px solid var(--color-accent);
    padding: 16px 24px; margin: 24px 0;
    background: rgba(230,126,34,0.05);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic; color: var(--color-text-light);
}
.article-content img { border-radius: 8px; margin: 24px 0; }
.article-content a { color: var(--color-accent); text-decoration: underline; text-underline-offset: 2px; }
.article-content pre {
    background: #1a2332; color: #e2e8f0;
    padding: 20px; border-radius: 8px;
    overflow-x: auto; margin: 24px 0;
    font-size: 0.9rem;
}
.article-content code {
    background: rgba(230,126,34,0.1); color: var(--color-accent);
    padding: 2px 6px; border-radius: 4px; font-size: 0.9em;
}
.article-content pre code { background: none; color: inherit; padding: 0; }

/* ========== AUTHOR BOX ========== */
.author-box {
    background: var(--color-card-bg);
    border-radius: var(--radius);
    padding: 32px; box-shadow: var(--shadow-card);
    display: flex; gap: 20px; align-items: center;
    margin-bottom: 32px;
}
.author-box__avatar {
    width: 72px; height: 72px; border-radius: 50%;
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-hover));
    flex-shrink: 0; overflow: hidden;
}
.author-box__avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-box__name {
    font-family: var(--font-heading);
    font-size: 1.1rem; font-weight: 700; margin-bottom: 4px;
}
.author-box__bio { font-size: 0.9rem; color: var(--color-text-light); }

/* ========== RELATED POSTS ========== */
.related-posts { margin-top: 48px; }
.related-posts__title {
    font-family: var(--font-heading);
    font-size: 1.4rem; text-align: center; margin-bottom: 24px;
}
.related-posts__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

/* ========== PAGINATION ========== */
.pagination {
    display: flex; justify-content: center; gap: 8px;
    padding: 32px 0 48px;
}
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 42px; height: 42px; padding: 0 14px;
    border-radius: 8px; font-weight: 600; font-size: 0.9rem;
    background: var(--color-card-bg); color: var(--color-text);
    box-shadow: var(--shadow-card); transition: all var(--transition);
}
.pagination a:hover { background: var(--color-accent); color: #fff; }
.pagination .current { background: var(--color-accent); color: #fff; }

/* ========== FOOTER ========== */
.site-footer {
    background: var(--color-footer-bg);
    padding: 48px 0 0;
    color: rgba(255,255,255,0.5);
    font-size: 0.85rem;
}
.footer-inner {
    max-width: var(--max-width); margin: 0 auto; padding: 0 24px;
}
.footer-top {
    display: flex; justify-content: space-between; align-items: flex-start;
    flex-wrap: wrap; gap: 32px; padding-bottom: 32px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.footer-brand .footer-logo {
    font-family: var(--font-heading);
    font-size: 1.3rem; font-weight: 800; color: #fff;
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 8px;
}
.footer-brand .footer-tagline { color: rgba(255,255,255,0.4); font-size: 0.85rem; }
.footer-links { display: flex; gap: 24px; flex-wrap: wrap; }
.footer-links a {
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.05em;
    transition: color var(--transition);
}
.footer-links a:hover { color: var(--color-accent); }

.footer-bottom {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 16px; padding: 24px 0;
}
.ai-disclosure {
    font-size: 0.75rem; color: rgba(255,255,255,0.3);
    display: flex; align-items: center; gap: 6px;
}
.ai-disclosure .ai-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--color-accent);
    animation: aiPulse 2s ease-in-out infinite;
}
@keyframes aiPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* ========== 404 PAGE ========== */
.error-404 {
    text-align: center; padding: 80px 24px;
}
.error-404__code {
    font-family: var(--font-heading);
    font-size: 8rem; font-weight: 900;
    color: var(--color-accent); opacity: 0.2;
    line-height: 1;
}
.error-404__title {
    font-size: 2rem; margin: 16px 0;
}
.error-404__text {
    color: var(--color-text-light); margin-bottom: 32px;
    max-width: 500px; margin-left: auto; margin-right: auto;
}
.error-404__btn {
    display: inline-block;
    background: var(--color-accent); color: #fff;
    padding: 12px 28px; border-radius: 8px;
    font-weight: 600; transition: background var(--transition);
}
.error-404__btn:hover { background: var(--color-accent-hover); color: #fff; }

/* ========== PAGE TEMPLATE ========== */
.page-header {
    background: linear-gradient(135deg, #111827 0%, #1a2332 100%);
    padding: 60px 0 40px; text-align: center;
}
.page-header h1 {
    font-family: var(--font-heading);
    font-size: 2.4rem; color: #fff;
}

/* ========== ARCHIVE ========== */
.archive-header {
    background: linear-gradient(135deg, #111827 0%, #1a2332 100%);
    padding: 60px 0 40px; text-align: center;
}
.archive-header h1 {
    font-family: var(--font-heading);
    font-size: 2rem; color: #fff; margin-bottom: 8px;
}
.archive-header .archive-desc { color: rgba(255,255,255,0.6); }

/* ========== UTILITIES ========== */
.screen-reader-text {
    clip: rect(1px,1px,1px,1px); position: absolute;
    height: 1px; width: 1px; overflow: hidden;
}

@media (max-width: 600px) {
    .posts-grid { grid-template-columns: 1fr; }
    .article-content { padding: 28px 20px; }
    .author-box { flex-direction: column; text-align: center; }
    .footer-top { flex-direction: column; }
}
