/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&family=Playfair+Display:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --bg-primary: #121214;
  --bg-secondary: #1a1a1e;
  --bg-card: #222228;
  --text-primary: #f3f4f6;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent-gold: #d4af37;
  --accent-gold-hover: #f3e5ab;
  --border-color: #2e2e36;
  --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7), 0 4px 6px -2px rgba(0, 0, 0, 0.7);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-gold);
  text-decoration: none;
  transition: color 0.3s ease, border-color 0.3s ease;
}

a:hover {
  color: var(--accent-gold-hover);
}

/* Header & Navigation */
header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap; /* Mobile compatibility: wrapping when squished */
  gap: 15px;
}

.logo {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
}

.logo a {
  color: var(--text-primary);
}

.logo span {
  color: var(--accent-gold);
}

nav {
  display: block;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 20px;
  flex-wrap: wrap; /* Mobile nav items wrap gracefully */
}

nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 5px 0;
}

nav a:hover, nav a.active {
  color: var(--accent-gold);
}

/* Hero Section */
.hero {
  background: linear-gradient(rgba(18, 18, 20, 0.85), rgba(18, 18, 20, 0.95)), url('https://images.unsplash.com/photo-1547996160-81dfa63595aa?auto=format&fit=crop&q=80&w=1200') no-repeat center center/cover;
  padding: 60px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}

.hero-container {
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: 32px; /* Responsive size starting point */
  color: var(--accent-gold);
  margin-bottom: 15px;
  font-weight: 700;
}

@media (min-width: 768px) {
  .hero h1 {
    font-size: 42px;
  }
}

.hero p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.6;
}

@media (min-width: 768px) {
  .hero p {
    font-size: 18px;
  }
}

/* Layout Grid */
.main-wrapper {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 15px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
}

/* Mobile FIRST, then desktop layout overrides */
@media (min-width: 992px) {
  .main-wrapper {
    grid-template-columns: 8fr 4fr;
    margin: 40px auto;
    padding: 0 20px;
  }
}

/* Post list */
.posts-grid {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.post-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 20px; /* Reduced for mobile padding */
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

@media (min-width: 768px) {
  .post-card {
    padding: 30px;
  }
}

.post-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-gold);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 15px;
}

.post-meta a {
  color: var(--text-muted);
}

.post-meta a:hover {
  color: var(--accent-gold);
}

.post-category {
  background-color: rgba(212, 175, 55, 0.15);
  color: var(--accent-gold);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 11px;
}

.post-card h2 {
  font-family: var(--font-serif);
  font-size: 20px;
  margin-bottom: 12px;
  line-height: 1.4;
}

@media (min-width: 768px) {
  .post-card h2 {
    font-size: 24px;
  }
}

.post-card h2 a {
  color: var(--text-primary);
}

.post-card h2 a:hover {
  color: var(--accent-gold);
}

.post-excerpt {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6;
}

@media (min-width: 768px) {
  .post-excerpt {
    font-size: 15px;
  }
}

.read-more-link {
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

/* On mobile, put sidebar widget first if needed, or default to bottom.
   Using default CSS grid order, sidebar falls underneath main content on mobile, which is correct */

.widget {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
  .widget {
    padding: 25px;
  }
}

.widget-title {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--accent-gold);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  margin-bottom: 15px;
  font-weight: 700;
  position: relative;
}

.widget-title::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 50px;
  height: 2px;
  background-color: var(--accent-gold);
}

.widget-about p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 15px;
  line-height: 1.6;
}

.widget-links-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.widget-links-list li {
  font-size: 14px;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 8px;
  line-height: 1.4;
}

.widget-links-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.widget-links-list a {
  color: var(--text-secondary);
  display: block;
}

.widget-links-list a:hover {
  color: var(--accent-gold);
  padding-left: 5px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-cloud a {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.tag-cloud a:hover {
  background-color: var(--accent-gold);
  color: #121214;
  border-color: var(--accent-gold);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 20px;
  flex-wrap: wrap; /* Prevent wrapping overflow on narrow screens */
}

.pagination-item {
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 4px;
  font-weight: 500;
  font-size: 13px;
  transition: all 0.3s ease;
}

@media (min-width: 768px) {
  .pagination-item {
    width: 40px;
    height: 40px;
    font-size: 15px;
  }
}

.pagination-item:hover, .pagination-item.active {
  background-color: var(--accent-gold);
  color: #121214;
  border-color: var(--accent-gold);
}

.pagination-item.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Single Post page styling */
.post-content-wrapper {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 15px; /* Tiny padding on mobile */
  box-shadow: var(--shadow-md);
  overflow-x: hidden; /* Prevent horizontal container spilling */
  word-wrap: break-word; /* Force wrapping of long unbroken words */
  word-break: break-word; /* Force break long texts/URLs */
}

@media (min-width: 768px) {
  .post-content-wrapper {
    padding: 40px;
  }
}

.post-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 20px;
  margin-bottom: 25px;
}

.post-header h1 {
  font-family: var(--font-serif);
  font-size: 24px;
  line-height: 1.3;
  margin-bottom: 15px;
  color: var(--accent-gold);
}

@media (min-width: 768px) {
  .post-header h1 {
    font-size: 32px;
  }
}

.post-body {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
}

@media (min-width: 768px) {
  .post-body {
    font-size: 16px;
    line-height: 1.8;
  }
}

.post-body h2 {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--accent-gold);
  margin-top: 30px;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

@media (min-width: 768px) {
  .post-body h2 {
    font-size: 22px;
    margin-top: 40px;
  }
}

.post-body h3 {
  font-size: 16px;
  margin-top: 20px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

@media (min-width: 768px) {
  .post-body h3 {
    font-size: 18px;
    margin-top: 25px;
  }
}

.post-body p {
  margin-bottom: 20px;
}

.post-body ul, .post-body ol {
  margin-bottom: 20px;
  padding-left: 20px;
}

.post-body li {
  margin-bottom: 8px;
}

.post-body strong {
  color: var(--accent-gold-hover);
}

/* Tables style in Post Body (Responsive scrollbar) */
.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 25px 0;
  font-size: 12px; /* Slightly smaller on mobile */
  display: block; /* Required for responsive overflow */
  overflow-x: auto; /* Scroll horizontally on small phone screens */
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
  .post-body table {
    display: table; /* Reset to normal table layout on desktop */
    font-size: 14px;
    overflow-x: visible;
  }
}

.post-body th, .post-body td {
  border: 1px solid var(--border-color);
  padding: 10px 12px;
  text-align: left;
  white-space: normal; /* Allow normal text wrap even inside mobile scroll container */
}

@media (min-width: 768px) {
  .post-body th, .post-body td {
    padding: 12px 15px;
    white-space: normal;
  }
}

.post-body th {
  background-color: var(--bg-secondary);
  color: var(--accent-gold);
  font-weight: 700;
}

.post-body tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Callouts or Promo block */
.post-body p align="center" {
  margin: 25px 0;
}

/* Next / Prev Post navigation */
.post-navigation {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
  border-top: 1px solid var(--border-color);
  padding-top: 25px;
  margin-top: 35px;
}

@media (min-width: 576px) {
  .post-navigation {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding-top: 30px;
    margin-top: 40px;
  }
}

.nav-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 15px 20px;
  display: flex;
  flex-direction: column;
}

.nav-box.next {
  text-align: right;
  align-items: flex-end;
}

.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 5px;
}

.nav-title {
  font-weight: 500;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}

@media (min-width: 768px) {
  .nav-title {
    font-size: 14px;
  }
}

.nav-title:hover {
  color: var(--accent-gold);
}

/* Footer */
footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 40px 15px 30px; /* Slimmed padding for mobile viewports */
  margin-top: 45px;
}

@media (min-width: 768px) {
  footer {
    padding: 60px 20px 30px;
    margin-top: 60px;
  }
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
  }
}

.footer-widget h3 {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--accent-gold);
  margin-bottom: 15px;
  font-weight: 700;
}

@media (min-width: 768px) {
  .footer-widget h3 {
    font-size: 18px;
    margin-bottom: 20px;
  }
}

.footer-widget p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

@media (min-width: 768px) {
  .footer-widget p {
    font-size: 14px;
  }
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 10px;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 13px;
}

@media (min-width: 768px) {
  .footer-links a {
    font-size: 14px;
  }
}

.footer-links a:hover {
  color: var(--accent-gold);
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
    padding-top: 30px;
  }
}

.copyright {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

@media (min-width: 768px) {
  .copyright {
    font-size: 13px;
    text-align: left;
  }
}

.footer-seo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  justify-content: center;
}

@media (min-width: 768px) {
  .footer-seo-links {
    font-size: 13px;
    justify-content: flex-end;
  }
}

.footer-seo-links a {
  color: var(--text-muted);
}

.footer-seo-links a:hover {
  color: var(--accent-gold);
}
