/*
Theme Name:  MUFCThai
Theme URI:   https://mufcthai.com
Author:      MUFCThai Team
Author URI:  https://mufcthai.com
Description: Lightweight, Mobile-First news theme for Manchester United fans in Thailand.
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: mufcthai
Tags:        news, football, responsive, seo, thai
*/

/* =========================================================
   TABLE OF CONTENTS
   1. CSS Variables & Reset
   2. Typography
   3. Layout Utilities
   4. Header & Navigation
   5. Breaking News Ticker
   6. Homepage – Featured Post
   7. Homepage – News Grid
   8. Post Card Component
   9. Single Post
  10. Sidebar & Widgets
  11. Archive / Category Page
  12. Footer
  13. Ad Zones
  14. Responsive (Tablet / Mobile)
   ========================================================= */

/* ─────────────────────────────────────────────────────────
   1. CSS VARIABLES & RESET
   ───────────────────────────────────────────────────────── */
:root {
    --red:        #DA291C;
    --dark:       #1A1A1A;
    --gold:       #FBE122;
    --white:      #FFFFFF;
    --gray-light: #F3F4F6;
    --gray-mid:   #E5E7EB;
    --gray-text:  #6B7280;
    --font-main:  'Prompt', 'Noto Sans Thai', sans-serif;
    --radius:     6px;
    --shadow:     0 2px 8px rgba(0,0,0,.10);
    --max-width:  1200px;
    --transition: .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-main);
    background: var(--gray-light);
    color: var(--dark);
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a   { color: var(--red); text-decoration: none; transition: color var(--transition); }
a:hover { color: #b01e14; }
ul, ol { list-style: none; }

/* ─────────────────────────────────────────────────────────
   2. TYPOGRAPHY
   ───────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--dark);
}
h1 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); }
h2 { font-size: clamp(1.3rem, 2.5vw, 1.75rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.35rem); }

p { margin-bottom: 1.1rem; }

/* ─────────────────────────────────────────────────────────
   3. LAYOUT UTILITIES
   ───────────────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

.site-main {
    max-width: var(--max-width);
    margin: 24px auto;
    padding: 0 16px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 28px;
    align-items: start;
}

/* Full-width pages (no sidebar) */
.site-main.full-width {
    grid-template-columns: 1fr;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--white);
    background: var(--red);
    display: inline-block;
    padding: 4px 14px;
    border-radius: var(--radius) var(--radius) 0 0;
    margin-bottom: 0;
}

.section-header {
    border-bottom: 3px solid var(--red);
    margin-bottom: 20px;
    padding-bottom: 2px;
}

/* ─────────────────────────────────────────────────────────
   4. HEADER & NAVIGATION
   ───────────────────────────────────────────────────────── */
#masthead {
    background: var(--dark);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 6px rgba(0,0,0,.35);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    gap: 20px;
}

/* Logo */
.site-logo a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--white);
    font-size: 1.3rem;
    font-weight: 800;
    white-space: nowrap;
}
.site-logo img { height: 40px; width: auto; }
.site-logo .logo-text span { color: var(--red); }

/* Primary Nav */
#primary-navigation { flex: 1; }

.nav-menu {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}

.nav-menu li a {
    color: #D1D5DB;
    font-size: .9rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: var(--radius);
    transition: background var(--transition), color var(--transition);
}

.nav-menu li a:hover,
.nav-menu li.current-menu-item > a {
    background: var(--red);
    color: var(--white);
}

/* Hamburger */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    gap: 5px;
}
.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Search */
.header-search {
    position: relative;
    flex-shrink: 0;
}
.header-search input {
    background: #2D2D2D;
    border: 1px solid #3D3D3D;
    border-radius: 20px;
    color: var(--white);
    font-family: var(--font-main);
    font-size: .85rem;
    padding: 6px 36px 6px 14px;
    width: 180px;
    transition: width var(--transition), background var(--transition);
    outline: none;
}
.header-search input::placeholder { color: #9CA3AF; }
.header-search input:focus { background: #383838; width: 220px; }
.header-search button {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.header-search button:hover { color: var(--white); }

/* ─────────────────────────────────────────────────────────
   5. BREAKING NEWS TICKER
   ───────────────────────────────────────────────────────── */
.breaking-bar {
    background: var(--red);
    overflow: hidden;
    height: 36px;
    display: flex;
    align-items: center;
}

.breaking-label {
    background: var(--gold);
    color: var(--dark);
    font-weight: 800;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    padding: 0 14px;
    height: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.ticker-wrapper {
    overflow: hidden;
    flex: 1;
    position: relative;
}

.ticker-track {
    display: flex;
    gap: 60px;
    white-space: nowrap;
    animation: ticker-scroll 30s linear infinite;
    padding-left: 20px;
}
.ticker-track:hover { animation-play-state: paused; }

.ticker-track a {
    color: var(--white);
    font-size: .85rem;
    font-weight: 600;
}
.ticker-track a:hover { color: var(--gold); }

@keyframes ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ─────────────────────────────────────────────────────────
   6. HOMEPAGE – FEATURED POST
   ───────────────────────────────────────────────────────── */
.featured-post {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 32px;
    min-height: 420px;
    display: flex;
    align-items: flex-end;
    box-shadow: var(--shadow);
}

.featured-post__thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}
.featured-post:hover .featured-post__thumb { transform: scale(1.03); }

.featured-post__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.2) 60%, transparent 100%);
}

.featured-post__content {
    position: relative;
    padding: 28px 28px 24px;
    z-index: 1;
    width: 100%;
}

.cat-badge {
    display: inline-block;
    background: var(--red);
    color: var(--white);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 3px 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.featured-post__title {
    color: var(--white);
    font-size: clamp(1.3rem, 3vw, 2rem);
    margin-bottom: 10px;
    text-shadow: 0 1px 4px rgba(0,0,0,.5);
}

.featured-post__meta {
    color: #D1D5DB;
    font-size: .82rem;
    display: flex;
    gap: 16px;
    align-items: center;
}

/* ─────────────────────────────────────────────────────────
   7. HOMEPAGE – NEWS GRID
   ───────────────────────────────────────────────────────── */
.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ─────────────────────────────────────────────────────────
   8. POST CARD COMPONENT
   ───────────────────────────────────────────────────────── */
.post-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--transition), transform var(--transition);
}
.post-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.14);
    transform: translateY(-3px);
}

.post-card__thumb-wrap {
    position: relative;
    padding-top: 56.25%; /* 16:9 */
    overflow: hidden;
    flex-shrink: 0;
}
.post-card__thumb-wrap img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}
.post-card:hover .post-card__thumb-wrap img { transform: scale(1.05); }

.post-card__thumb-placeholder {
    position: absolute;
    inset: 0;
    background: var(--gray-mid);
    display: flex;
    align-items: center;
    justify-content: center;
}
.post-card__thumb-placeholder svg { opacity: .25; }

.post-card__body {
    padding: 14px 16px 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.post-card__cat {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--red);
    margin-bottom: 6px;
}

.post-card__title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.post-card__title a { color: var(--dark); }
.post-card__title a:hover { color: var(--red); }

.post-card__excerpt {
    font-size: .85rem;
    color: var(--gray-text);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.post-card__meta {
    font-size: .75rem;
    color: #9CA3AF;
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--gray-mid);
}

/* ─────────────────────────────────────────────────────────
   9. SINGLE POST
   ───────────────────────────────────────────────────────── */
.single-article {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.single-article__hero {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
}

.single-article__inner {
    padding: 28px 32px 36px;
}

.single-article__cats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.single-article__title {
    font-size: clamp(1.5rem, 3.5vw, 2.1rem);
    line-height: 1.3;
    margin-bottom: 16px;
}

.single-article__meta {
    display: flex;
    gap: 20px;
    font-size: .82rem;
    color: var(--gray-text);
    padding-bottom: 20px;
    border-bottom: 2px solid var(--gray-mid);
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
}
.single-article__meta a { color: var(--gray-text); }
.single-article__meta a:hover { color: var(--red); }
.meta-dot { color: var(--gray-mid); }

/* Content */
.entry-content h2 { font-size: 1.4rem; margin: 1.8rem 0 .8rem; }
.entry-content h3 { font-size: 1.2rem; margin: 1.5rem 0 .7rem; }
.entry-content p  { margin-bottom: 1.2rem; }
.entry-content ul,
.entry-content ol { margin: 0 0 1.2rem 1.4rem; }
.entry-content ul { list-style: disc; }
.entry-content ol { list-style: decimal; }
.entry-content li { margin-bottom: .4rem; }
.entry-content blockquote {
    border-left: 4px solid var(--red);
    background: var(--gray-light);
    padding: 14px 20px;
    margin: 1.5rem 0;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
}
.entry-content img {
    border-radius: var(--radius);
    margin: 1rem 0;
}
.entry-content a { text-decoration: underline; text-decoration-color: rgba(218,41,28,.4); }
.entry-content a:hover { text-decoration-color: var(--red); }

/* In-Content Ad Zone */
.ad-in-content {
    margin: 28px 0;
    text-align: center;
    background: var(--gray-light);
    border: 1px dashed var(--gray-mid);
    border-radius: var(--radius);
    padding: 16px;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Source link */
.source-link {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-mid);
    font-size: .82rem;
    color: var(--gray-text);
}

/* Tags */
.post-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-mid);
}
.tag-chip {
    background: var(--gray-light);
    border: 1px solid var(--gray-mid);
    border-radius: 20px;
    font-size: .78rem;
    padding: 4px 12px;
    color: var(--dark);
    transition: background var(--transition);
}
.tag-chip:hover { background: var(--red); color: var(--white); border-color: var(--red); }

/* ─────────────────────────────────────────────────────────
   10. SIDEBAR & WIDGETS
   ───────────────────────────────────────────────────────── */
.sidebar { position: sticky; top: 80px; }

.widget {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

.widget-title {
    background: var(--dark);
    color: var(--white);
    font-size: .85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    padding: 10px 16px;
    margin: 0;
}

.widget-inner { padding: 14px 16px; }

/* Trending list */
.trending-list { padding: 10px 16px; }
.trending-list li {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-mid);
    align-items: flex-start;
}
.trending-list li:last-child { border-bottom: none; }
.trending-num {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--gray-mid);
    line-height: 1;
    flex-shrink: 0;
    min-width: 26px;
}
.trending-list li:first-child .trending-num { color: var(--red); }
.trending-list a {
    color: var(--dark);
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.4;
}
.trending-list a:hover { color: var(--red); }

/* Ad zone sidebar */
.ad-sidebar {
    background: var(--gray-light);
    border: 1px dashed var(--gray-mid);
    border-radius: var(--radius);
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    color: var(--gray-text);
    text-align: center;
    margin-bottom: 24px;
    padding: 16px;
}

/* ─────────────────────────────────────────────────────────
   11. ARCHIVE / CATEGORY PAGE
   ───────────────────────────────────────────────────────── */
.archive-header {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border-left: 5px solid var(--red);
}
.archive-header h1 {
    font-size: 1.5rem;
    margin-bottom: 4px;
}
.archive-header p {
    color: var(--gray-text);
    font-size: .9rem;
    margin: 0;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 32px 0;
    flex-wrap: wrap;
}
.pagination .page-numbers {
    background: var(--white);
    border: 1px solid var(--gray-mid);
    border-radius: var(--radius);
    padding: 8px 14px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--dark);
    transition: background var(--transition);
}
.pagination .page-numbers.current,
.pagination .page-numbers:hover {
    background: var(--red);
    border-color: var(--red);
    color: var(--white);
}

/* ─────────────────────────────────────────────────────────
   12. FOOTER
   ───────────────────────────────────────────────────────── */
#colophon {
    background: var(--dark);
    color: #9CA3AF;
    margin-top: 48px;
}

.footer-widgets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
    padding: 48px 0 36px;
}

.footer-widget-title {
    color: var(--white);
    font-size: .9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--red);
    display: inline-block;
}

.footer-about p { font-size: .85rem; line-height: 1.7; }

.footer-links li { margin-bottom: 8px; }
.footer-links a {
    color: #9CA3AF;
    font-size: .85rem;
    transition: color var(--transition), padding-left var(--transition);
}
.footer-links a:hover { color: var(--gold); padding-left: 4px; }

.social-icons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.social-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #2D2D2D;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9CA3AF;
    font-size: 1rem;
    transition: background var(--transition), color var(--transition);
}
.social-icon:hover { background: var(--red); color: var(--white); }
.social-icon svg { width: 18px; height: 18px; fill: currentColor; }

.footer-bottom {
    border-top: 1px solid #2D2D2D;
    padding: 16px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .8rem;
    flex-wrap: wrap;
    gap: 8px;
}
.footer-bottom a { color: #9CA3AF; }
.footer-bottom a:hover { color: var(--gold); }

/* ─────────────────────────────────────────────────────────
   13. AD ZONES
   ───────────────────────────────────────────────────────── */
.ad-header-zone {
    background: var(--gray-light);
    border-bottom: 1px solid var(--gray-mid);
    text-align: center;
    padding: 8px 16px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─────────────────────────────────────────────────────────
   14. RESPONSIVE
   ───────────────────────────────────────────────────────── */

/* Tablet */
@media (max-width: 1024px) {
    .footer-widgets { grid-template-columns: repeat(2, 1fr); }
    .news-grid { grid-template-columns: repeat(2, 1fr); }
    .site-main { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .header-search input { width: 140px; }
    .header-search input:focus { width: 180px; }
}

/* Mobile */
@media (max-width: 640px) {
    .header-inner { height: 54px; }

    .menu-toggle { display: flex; }

    #primary-navigation {
        display: none;
        position: absolute;
        top: 54px;
        left: 0;
        right: 0;
        background: var(--dark);
        border-top: 2px solid var(--red);
        padding: 12px 16px;
        z-index: 999;
    }
    #primary-navigation.is-open { display: block; }

    .nav-menu {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    .nav-menu li { width: 100%; }
    .nav-menu li a { display: block; padding: 10px 12px; }

    .header-search { display: none; }

    .featured-post { min-height: 260px; }
    .featured-post__content { padding: 16px; }

    .news-grid { grid-template-columns: 1fr; }

    .single-article__inner { padding: 18px 16px 24px; }

    .footer-widgets { grid-template-columns: 1fr; gap: 20px; padding: 32px 0 24px; }

    .footer-bottom { justify-content: center; text-align: center; }

    .ticker-track { animation-duration: 20s; }

    .breaking-label { font-size: .72rem; padding: 0 10px; }
}

/* ─────────────────────────────────────────────────────────
   UTILITY
   ───────────────────────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}

.no-posts {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow);
    grid-column: 1/-1;
}
