/* Snackable Yarn - Storytelling Theme */

:root {
  --color-brand: #2d3436;
  --color-brand-accent: #e17055;
  --color-text: #1a1a1a;
  --color-text-secondary: #555;
  --color-text-muted: #888;
  --color-background: #ffffff;
  --color-surface: #faf8f5;
  --color-surface-alt: #f1ede8;
  --color-border: #e5dfd8;
  --color-link: #d35400;
  --color-link-hover: #a04000;
  --font-headline: 'Georgia', 'Times New Roman', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --max-width: 1200px;
  --content-width: 760px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-headline);
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  color: var(--color-text);
}

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--color-link-hover);
}

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

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

/* ========================================
   HEADER
   ======================================== */

.site-header {
  background: var(--color-brand);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0;
  padding-bottom: 0;
  height: 64px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-logo .logo-image {
  height: 44px;
  width: auto;
  transition: opacity 0.15s ease;
}

.site-logo:hover .logo-image {
  opacity: 0.85;
}

.site-logo h1 {
  font-family: var(--font-headline);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
  margin: 0;
}

.site-logo:hover h1 {
  color: var(--color-brand-accent);
}

.tagline {
  display: none;
}

.main-nav {
  display: flex;
  gap: 8px;
}

.main-nav a {
  color: rgba(255,255,255,0.85);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.main-nav a:hover,
.main-nav a.active {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

/* ========================================
   HERO / HOMEPAGE
   ======================================== */

.hero {
  background: linear-gradient(135deg, var(--color-brand) 0%, #4a4a4a 100%);
  color: #fff;
  padding: 80px 0;
  text-align: center;
  margin-bottom: 48px;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 16px;
  letter-spacing: -1px;
}

.hero .tagline {
  display: block;
  font-size: 1.4rem;
  color: var(--color-brand-accent);
  font-weight: 500;
  margin-bottom: 12px;
}

.hero .description {
  font-size: 1.15rem;
  color: rgba(255,255,255,0.8);
  max-width: 600px;
  margin: 0 auto;
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.site-main {
  min-height: calc(100vh - 300px);
  padding: 48px 0;
}

/* Latest Posts Section */
.latest-posts {
  max-width: var(--max-width);
  margin: 0 auto;
}

.latest-posts h2 {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-brand-accent);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--color-brand);
}

/* Post Grid */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 32px;
}

/* ========================================
   POST CARDS
   ======================================== */

.post-preview {
  background: var(--color-background);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.post-preview:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.post-preview .thumbnail {
  width: 100%;
  height: 200px;
  background: var(--color-surface-alt);
  overflow: hidden;
}

.post-preview .thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.post-preview:hover .thumbnail img {
  transform: scale(1.05);
}

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

.post-preview .category {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-brand-accent);
  margin-bottom: 8px;
}

.post-preview h2,
.post-preview h3 {
  font-size: 1.25rem;
  line-height: 1.35;
  margin-bottom: 12px;
}

.post-preview h2 a,
.post-preview h3 a {
  color: var(--color-text);
  display: block;
}

.post-preview h2 a:hover,
.post-preview h3 a:hover {
  color: var(--color-brand-accent);
}

.post-preview .summary {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 16px;
  flex: 1;
}

.post-preview .meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

.post-preview time {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.read-more {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-brand-accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.read-more:hover {
  color: var(--color-brand);
}

.no-posts {
  text-align: center;
  padding: 80px 40px;
  background: var(--color-surface);
  border-radius: 12px;
  border: 2px dashed var(--color-border);
}

.no-posts p {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  margin: 0;
}

.view-all {
  text-align: center;
  margin-top: 40px;
}

.view-all a {
  display: inline-block;
  padding: 12px 32px;
  background: var(--color-brand);
  color: #fff;
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.view-all a:hover {
  background: var(--color-brand-accent);
  color: #fff;
}

/* ========================================
   SINGLE POST / ARTICLE
   ======================================== */

.post {
  max-width: var(--content-width);
  margin: 0 auto;
}

.post-header {
  margin-bottom: 40px;
  text-align: center;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--color-border);
}

.post-header .category {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-brand-accent);
  margin-bottom: 16px;
}

.post-header h1 {
  font-size: 2.75rem;
  line-height: 1.15;
  margin-bottom: 20px;
  letter-spacing: -0.5px;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.post-meta .author {
  font-weight: 600;
  color: var(--color-text-secondary);
}

.reading-time {
  background: var(--color-surface);
  padding: 4px 12px;
  border-radius: 20px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.tag {
  background: var(--color-surface);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  transition: all 0.15s ease;
}

.tag:hover {
  background: var(--color-brand);
  color: #fff;
}

/* Featured Image */
.featured-image {
  margin: 0 -100px 40px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.featured-image img {
  width: 100%;
}

@media (max-width: 960px) {
  .featured-image {
    margin: 0 0 40px;
  }
}

/* Article Content */
.post-content {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--color-text);
}

.post-content p {
  margin: 0 0 1.5em;
}

.post-content h2 {
  font-size: 1.75rem;
  margin: 2em 0 0.75em;
  padding-top: 1em;
  border-top: 1px solid var(--color-border);
}

.post-content h3 {
  font-size: 1.4rem;
  margin: 1.75em 0 0.5em;
}

.post-content h4 {
  font-size: 1.15rem;
  margin: 1.5em 0 0.5em;
}

.post-content blockquote {
  margin: 2em 0;
  padding: 24px 32px;
  background: var(--color-surface);
  border-left: 4px solid var(--color-brand-accent);
  font-size: 1.15rem;
  font-style: italic;
  color: var(--color-text-secondary);
  border-radius: 0 8px 8px 0;
}

.post-content blockquote p:last-child {
  margin-bottom: 0;
}

.post-content ul,
.post-content ol {
  margin: 1.5em 0;
  padding-left: 1.5em;
}

.post-content li {
  margin-bottom: 0.5em;
}

.post-content pre {
  background: var(--color-brand);
  color: #f8f8f2;
  padding: 24px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 2em 0;
}

.post-content code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  background: var(--color-surface);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.post-content pre code {
  background: none;
  padding: 0;
}

.post-content a {
  color: var(--color-brand-accent);
  text-decoration: underline;
  text-decoration-color: rgba(225, 112, 85, 0.3);
  text-underline-offset: 2px;
}

.post-content a:hover {
  text-decoration-color: var(--color-brand-accent);
}

/* Video Embed */
.video-embed {
  margin: 40px 0;
  padding: 32px;
  background: linear-gradient(135deg, var(--color-brand) 0%, #4a4a4a 100%);
  border-radius: 12px;
  text-align: center;
  color: #fff;
}

.video-embed h3 {
  color: #fff;
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.video-embed p {
  margin: 0;
}

.video-embed a {
  color: var(--color-brand-accent);
  font-weight: 600;
  font-size: 1.1rem;
}

.video-embed a:hover {
  color: #fff;
}

/* Post Footer */
.post-footer {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 2px solid var(--color-border);
}

.share-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.share-buttons span {
  font-weight: 600;
  color: var(--color-text-secondary);
}

.share-buttons a {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  background: var(--color-surface);
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  transition: all 0.15s ease;
}

.share-buttons a:hover {
  background: var(--color-brand);
  color: #fff;
}

.post-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 32px;
}

.post-navigation a {
  padding: 24px;
  background: var(--color-surface);
  border-radius: 8px;
  color: var(--color-text);
  font-weight: 500;
  transition: all 0.15s ease;
  border: 1px solid var(--color-border);
}

.post-navigation a:hover {
  background: var(--color-brand);
  color: #fff;
  border-color: var(--color-brand);
}

.post-navigation a.prev {
  text-align: left;
}

.post-navigation a.next {
  text-align: right;
}

/* ========================================
   LIST PAGES
   ======================================== */

.page-header {
  text-align: center;
  padding: 60px 0;
  background: var(--color-surface);
  margin: -48px -24px 48px;
}

.page-header h1 {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.page-header .description {
  color: var(--color-text-secondary);
  font-size: 1.15rem;
  max-width: 600px;
  margin: 0 auto;
}

.post-list {
  max-width: var(--content-width);
  margin: 0 auto;
}

.post-list .post-preview {
  margin-bottom: 32px;
  flex-direction: row;
  align-items: stretch;
}

.post-list .post-preview .thumbnail {
  width: 280px;
  min-width: 280px;
  height: auto;
}

.post-list .post-preview .content {
  padding: 24px 28px;
}

@media (max-width: 768px) {
  .post-list .post-preview {
    flex-direction: column;
  }

  .post-list .post-preview .thumbnail {
    width: 100%;
    height: 200px;
  }
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  background: var(--color-surface);
  border-radius: 6px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.pagination a:hover {
  background: var(--color-brand);
  color: #fff;
}

.pagination .active {
  background: var(--color-brand);
  color: #fff;
}

/* ========================================
   FOOTER
   ======================================== */

.site-footer {
  background: var(--color-brand);
  color: rgba(255,255,255,0.9);
  padding: 48px 0;
  margin-top: 80px;
}

.site-footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.site-footer p {
  margin: 4px 0;
  font-size: 0.95rem;
}

.footer-tagline {
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  .site-header .container {
    height: 56px;
  }

  .site-logo h1 {
    font-size: 1.25rem;
  }

  .main-nav a {
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  .hero {
    padding: 48px 0;
  }

  .hero h1 {
    font-size: 2.25rem;
  }

  .hero .tagline {
    font-size: 1.1rem;
  }

  .post-header h1 {
    font-size: 2rem;
  }

  .post-content {
    font-size: 1.05rem;
  }

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

  .post-navigation {
    grid-template-columns: 1fr;
  }

  .share-buttons {
    flex-wrap: wrap;
  }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
