/*
Theme Name: CowFounder
Theme URI: https://cowfounder.com/blog
Author: CowFounder
Author URI: https://cowfounder.com
Description: A minimal, clean theme for the CowFounder blog. Matches the cowfounder.com brand — Inter typeface, dark navy ink, professional layout.
Version: 1.0.0
License: GNU General Public License v2 or later
Tags: minimal, blog, clean, professional
Text Domain: cowfounder
*/

/* ─── Variables ─── */
:root {
  --ink:        #0f172a;
  --white:      #ffffff;
  --gray-50:    #f9fafb;
  --gray-100:   #f3f4f6;
  --gray-200:   #e5e7eb;
  --gray-300:   #d1d5db;
  --gray-500:   #6b7280;
  --gray-700:   #374151;
  --highlight:  #e8f0fe;
  --cow-spot:   #1c2b4a;
  --accent:     #2979ff;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 4px 24px rgba(0,0,0,.07);
  --shadow-lg:  0 16px 48px rgba(0,0,0,.11);
  --font:       'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

/* ─── Typography ─── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
}

h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.4rem); }
h4 { font-size: 1.1rem; }

p { color: var(--gray-700); }

/* ─── Layout ─── */
.site { display: flex; flex-direction: column; min-height: 100vh; }
.site-content { flex: 1; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 720px; margin: 0 auto; padding: 0 24px; }

/* ─── Nav ─── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-100);
}

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

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink);
  letter-spacing: -0.03em;
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: var(--ink);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  line-height: 1;
  flex-shrink: 0;
}

.main-nav { display: flex; align-items: center; gap: 4px; }

.main-nav a {
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--gray-700);
  transition: background .15s, color .15s;
}

.main-nav a:hover,
.main-nav a.current { color: var(--ink); background: var(--gray-100); }

.nav-back-btn {
  background: var(--ink) !important;
  color: var(--white) !important;
  font-weight: 600 !important;
  padding: 8px 16px !important;
}

.nav-back-btn:hover { opacity: .85 !important; }

/* ─── Blog Hero / Page Title Bar ─── */
.blog-hero {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
  padding: 56px 0 48px;
}

.blog-hero .tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--white);
  margin-bottom: 16px;
}

.blog-hero h1 { margin-bottom: 12px; }
.blog-hero p { color: var(--gray-500); font-size: 1rem; max-width: 480px; }

/* ─── Post Grid ─── */
.posts-section { padding: 64px 0 96px; }

.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

/* ─── Post Card ─── */
.post-card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}

.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.post-card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--gray-100);
}

.post-card-thumb-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}

.post-card-body {
  padding: 24px 28px 28px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.post-card-cat {
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--cow-spot);
  background: var(--highlight);
  padding: 3px 10px;
  border-radius: 100px;
}

.post-card-date {
  font-size: 0.8rem;
  color: var(--gray-500);
}

.post-card h2 {
  font-size: 1.05rem;
  margin-bottom: 10px;
  line-height: 1.4;
}

.post-card h2 a { color: var(--ink); transition: opacity .15s; }
.post-card h2 a:hover { opacity: .65; }

.post-card p {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--gray-500);
  margin-bottom: 20px;
  flex: 1;
}

.post-card-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  border-bottom: 1.5px solid var(--ink);
  padding-bottom: 1px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: opacity .15s;
  align-self: flex-start;
}

.post-card-link:hover { opacity: .55; }

/* ─── Single Post ─── */
.single-post-header {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
  padding: 56px 0 48px;
}

.single-post-header .post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.post-cat-tag {
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--cow-spot);
  background: var(--highlight);
  padding: 4px 12px;
  border-radius: 100px;
}

.post-date-tag {
  font-size: 0.83rem;
  color: var(--gray-500);
}

.single-post-header h1 { margin-bottom: 16px; max-width: 720px; }

.post-author-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.87rem;
  color: var(--gray-500);
  margin-top: 12px;
}

.author-dot {
  width: 28px;
  height: 28px;
  background: var(--ink);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--white);
  font-weight: 700;
  flex-shrink: 0;
}

/* ─── Post Featured Image ─── */
.post-featured-image {
  margin: 48px 0 0;
}

.post-featured-image img {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: var(--radius);
}

/* ─── Post Content ─── */
.post-content-wrap { padding: 56px 0 80px; }

.entry-content {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--gray-700);
}

.entry-content > * + * { margin-top: 1.5em; }

.entry-content h2 {
  font-size: 1.55rem;
  margin-top: 2.2em;
  margin-bottom: .6em;
  color: var(--ink);
}

.entry-content h3 {
  font-size: 1.2rem;
  margin-top: 1.8em;
  margin-bottom: .5em;
  color: var(--ink);
}

.entry-content p { color: var(--gray-700); }

.entry-content a {
  color: var(--ink);
  border-bottom: 1.5px solid var(--gray-300);
  transition: border-color .15s;
}

.entry-content a:hover { border-color: var(--ink); }

.entry-content ul, .entry-content ol {
  padding-left: 1.5em;
  color: var(--gray-700);
}

.entry-content li { margin-bottom: .5em; }

.entry-content blockquote {
  border-left: 3px solid var(--ink);
  padding: 4px 0 4px 24px;
  margin: 2em 0;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--gray-500);
}

.entry-content code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--gray-100);
  padding: 2px 7px;
  border-radius: 5px;
  color: var(--cow-spot);
}

.entry-content pre {
  background: var(--ink);
  color: #e2e8f0;
  padding: 24px 28px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .88rem;
  line-height: 1.7;
}

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

.entry-content img {
  border-radius: var(--radius-sm);
  margin: 1.5em 0;
}

.entry-content hr {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 2.5em 0;
}

/* ─── Post Nav (prev/next) ─── */
.post-navigation {
  border-top: 1px solid var(--gray-100);
  padding: 40px 0;
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.nav-post-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 44%;
}

.nav-post-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gray-500);
}

.nav-post-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  transition: opacity .15s;
}

.nav-post-title:hover { opacity: .6; }

/* ─── Sidebar ─── */
.content-sidebar-wrap {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 56px;
  align-items: start;
}

.sidebar { position: sticky; top: 88px; }

.widget {
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 24px;
}

.widget-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}

.widget ul { list-style: none; }
.widget li { padding: 8px 0; border-bottom: 1px solid var(--gray-100); font-size: .88rem; }
.widget li:last-child { border-bottom: none; }
.widget a { color: var(--gray-700); transition: color .15s; }
.widget a:hover { color: var(--ink); }

/* ─── Pagination ─── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 48px 0 0;
  flex-wrap: wrap;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  border: 1.5px solid var(--gray-200);
  color: var(--gray-700);
  transition: all .15s;
}

.pagination a:hover { border-color: var(--ink); color: var(--ink); background: var(--gray-50); }
.pagination .current { background: var(--ink); color: var(--white); border-color: var(--ink); }

/* ─── No Posts ─── */
.no-results { padding: 64px 0; text-align: center; }
.no-results h2 { margin-bottom: 12px; }
.no-results p { color: var(--gray-500); }

/* ─── Footer ─── */
.site-footer {
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
  padding: 40px 0 28px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
  letter-spacing: -0.03em;
}

.footer-copy { font-size: .82rem; color: var(--gray-500); }

.footer-links { display: flex; gap: 20px; }
.footer-links a { font-size: .85rem; color: var(--gray-500); transition: color .15s; }
.footer-links a:hover { color: var(--ink); }

/* ─── Search Form ─── */
.search-form { display: flex; gap: 8px; }
.search-field {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: var(--font);
  outline: none;
  transition: border-color .15s;
}

.search-field:focus { border-color: var(--ink); }
.search-submit {
  padding: 10px 16px;
  background: var(--ink);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity .15s;
}

.search-submit:hover { opacity: .82; }

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
  .content-sidebar-wrap { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}

@media (max-width: 600px) {
  .posts-grid { grid-template-columns: 1fr; }
  .post-navigation { flex-direction: column; }
  .nav-post-link { max-width: 100%; }
  .main-nav { display: none; }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-links { justify-content: center; }
}
