/* ==========================================================================
   Khula Platform — Blog stylesheet
   Editorial aesthetic inspired by printingpress.dev, adapted for Khula brand.
   Fraunces serif headings · Manrope sans body · teal/mint/ink palette.
   ========================================================================== */

/* 1. Custom properties --------------------------------------------------- */
:root {
  --blog-max-prose: 720px;
  --blog-max-listing: 1080px;
  --blog-teal: #1f9e7a;
  --blog-mint: #f5fbf8;
  --blog-ink: #1a1a1a;
  --blog-muted: #6b7280;
  --blog-border: #d4e9df;
  --blog-card-bg: #ffffff;
  --blog-take-bg: #0f2e24;
  --blog-take-text: #e4f4ee;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body.blog-body {
  margin: 0;
  background: var(--blog-mint);
  color: var(--blog-ink);
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
}

/* 3. Navigation ---------------------------------------------------------- */
.blog-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  background: var(--blog-mint);
  border-bottom: 1px solid var(--blog-teal);
}

.blog-nav__logo {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--blog-teal);
  text-decoration: none;
}

.blog-nav__logo:hover {
  text-decoration: underline;
}

.blog-nav__listing {
  font-size: 0.85rem;
  color: var(--blog-muted);
  text-decoration: none;
  transition: color 150ms ease;
}

.blog-nav__listing:hover {
  color: var(--blog-teal);
}

/* 4. Listing page -------------------------------------------------------- */
.blog-listing {
  max-width: var(--blog-max-listing);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.blog-listing__header {
  margin-bottom: 2.5rem;
}

.blog-listing__header h1 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
  color: var(--blog-ink);
}

.blog-listing__header p {
  margin: 0;
  max-width: 60ch;
  color: var(--blog-muted);
  font-size: 1.0625rem;
  line-height: 1.6;
}

/* 5. Post grid + cards --------------------------------------------------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.post-card {
  display: flex;
  flex-direction: column;
  background: var(--blog-card-bg);
  border: 1px solid var(--blog-border);
  border-radius: 6px;
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.post-card:hover {
  border-color: var(--blog-teal);
  box-shadow: 0 4px 16px rgba(31, 158, 122, 0.08);
  transform: translateY(-2px);
}

.post-card--muted {
  background: #fbfdfc;
}

.post-card--muted .post-card__title {
  color: #374151;
}

.post-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.tag-pill {
  display: inline-block;
  padding: 0.2em 0.7em;
  border: 1px solid var(--blog-border);
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--blog-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 150ms ease, color 150ms ease;
}

.tag-pill:hover {
  border-color: var(--blog-teal);
  color: var(--blog-teal);
}

.post-card__title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 0.5rem;
  color: var(--blog-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__excerpt {
  flex-grow: 1;
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--blog-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--blog-border);
  font-size: 0.78rem;
  color: var(--blog-muted);
}

.post-card__read {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--blog-teal);
}

/* 6. Archive note (listing) --------------------------------------------- */
.archive-note {
  background: #fffbf0;
  border: 1px solid #f5e6b0;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* 7. Article page -------------------------------------------------------- */
.blog-article {
  max-width: var(--blog-max-prose);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.post-header {
  margin-bottom: 2rem;
}

.post-header h1 {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  color: var(--blog-ink);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--blog-border);
  font-size: 0.82rem;
  color: var(--blog-muted);
}

.post-meta .tag-pill {
  font-size: 0.72rem;
  color: var(--blog-muted);
}

/* 8. Prose content ------------------------------------------------------- */
.post-content {
  font-size: 1.0625rem;
}

.post-content p {
  line-height: 1.8;
  margin: 0 0 1.25rem;
}

.post-content h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 2rem 0 0.75rem;
  color: var(--blog-ink);
}

.post-content h3 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 1.75rem 0 0.5rem;
  color: var(--blog-ink);
}

.post-content strong {
  font-weight: 600;
  color: var(--blog-ink);
}

.post-content a {
  color: var(--blog-teal);
  text-decoration: none;
}

.post-content a:hover {
  text-decoration: underline;
}

.post-content ul,
.post-content ol {
  margin: 0 0 1.25rem;
  padding-left: 1.4rem;
  line-height: 1.8;
}

.post-content li {
  margin-bottom: 0.4rem;
}

.post-content blockquote {
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  border-left: 3px solid var(--blog-teal);
  background: var(--blog-mint);
  font-style: italic;
  color: #2c3e38;
}

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

.post-content code {
  background: #1a2420;
  color: #e4f4ee;
  font-family: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
  font-size: 0.875rem;
  border-radius: 4px;
  padding: 0.15em 0.35em;
}

.post-content pre {
  background: #1a2420;
  color: #e4f4ee;
  font-family: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  border-radius: 4px;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
}

.post-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

.post-content hr {
  border: 0;
  border-top: 1px solid var(--blog-teal);
  opacity: 0.25;
  margin: 2.5rem 0;
}

.post-content img {
  border-radius: 6px;
  margin: 1.5rem 0;
}

/* 9. Khula take callout -------------------------------------------------- */
.khula-take {
  background: var(--blog-take-bg);
  color: var(--blog-take-text);
  border-left: 4px solid var(--blog-teal);
  border-radius: 0 8px 8px 0;
  padding: 1.5rem 2rem;
  margin: 2.5rem 0;
}

.khula-take h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--blog-teal);
  margin: 0 0 0.75rem;
}

.khula-take p {
  color: var(--blog-take-text);
  line-height: 1.7;
  margin: 0 0 0.75rem;
}

.khula-take p:last-child {
  margin-bottom: 0;
}

.khula-take strong {
  color: #a7e6d0;
}

/* 10. Audio player ------------------------------------------------------- */
.audio-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--blog-mint);
  border: 1px solid var(--blog-border);
  border-radius: 8px;
  padding: 0.875rem 1.25rem;
  margin: 2rem 0;
}

.audio-wrapper audio {
  flex: 1;
  min-width: 0;
  height: 38px;
}

.audio-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blog-muted);
  white-space: nowrap;
}

/* 11. Social share ------------------------------------------------------- */
.social-share {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 1rem;
  margin: 2.5rem 0;
  padding: 1.25rem 0;
  border-top: 1px solid var(--blog-border);
  border-bottom: 1px solid var(--blog-border);
  font-size: 0.85rem;
}

.social-share__label {
  color: var(--blog-muted);
  font-weight: 500;
}

.social-share__link {
  color: var(--blog-teal);
  font-weight: 500;
  text-decoration: none;
}

.social-share__link:hover {
  text-decoration: underline;
}

/* 12. Related posts ------------------------------------------------------ */
.related-posts {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--blog-border);
}

.related-posts h3 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 1rem;
  color: var(--blog-ink);
}

.related-posts__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.related-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border: 1px solid var(--blog-border);
  border-radius: 6px;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.related-card:hover {
  border-color: var(--blog-teal);
  box-shadow: 0 2px 10px rgba(31, 158, 122, 0.07);
}

.related-card__title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--blog-ink);
}

.related-card__meta {
  font-size: 0.75rem;
  color: var(--blog-muted);
}

/* 13. Footer ------------------------------------------------------------- */
.blog-footer {
  max-width: var(--blog-max-listing);
  margin: 3rem auto 0;
  padding: 1.5rem;
  border-top: 1px solid var(--blog-border);
  font-size: 0.82rem;
  color: var(--blog-muted);
  text-align: center;
}

.blog-footer a {
  color: var(--blog-teal);
  text-decoration: none;
}

.blog-footer a:hover {
  text-decoration: underline;
}

/* 14. Responsive --------------------------------------------------------- */
@media (max-width: 768px) {
  .post-grid {
    grid-template-columns: 1fr;
  }

  .blog-article {
    padding: 1.25rem 1rem;
  }

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

  .blog-listing__header h1 {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .audio-wrapper {
    flex-direction: column;
    align-items: stretch;
  }

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

  .related-posts__grid {
    grid-template-columns: 1fr;
  }
}

/* 15. Reduced motion ----------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .post-card:hover {
    transform: none;
  }
}
