/* ---------------------------------------------------------------------------
   WebRun blog — article/gallery styles ONLY.

   The blog no longer ships its own design system: /style.css owns :root, *, body,
   a, header, nav and footer, and the shared includes/header.php + includes/footer.php
   render the real site chrome. What lives here is the part that is genuinely
   blog-specific — the post gallery, the article body typography and the CardGroup
   component. Loaded after /style.css via $extra_css, so it layers on top.

   Naming: the page hero is .blog-hero, never .hero — /style.css owns .hero as the
   100vh two-column marketing hero, which would blow up an article index.
   --------------------------------------------------------------------------- */

:root {
  /* Blog-only tokens. --cream/--forest/--text/--text-muted come from /style.css
     and are deliberately NOT redefined here — the fork of those values is what
     made /blog render in slightly different colours than the rest of the site. */
  --cream-dark: #f5f0e8;
  --orange: #d4774b;
  --border: #e5e0d8;
}

/* /style.css has no global anchor reset (each component sets its own), and the
   blog's own `a { color: inherit }` went away with the forked design system —
   so restore it here, scoped to the blog. .article-body a below re-styles prose
   links on top of this. */
.blog-main a { color: inherit; text-decoration: none; }

/* Clears the fixed site header (85px bar + 1rem gap), same job the old `main`
   rule did before the blog shared the site's chrome. */
.blog-main {
  min-height: 60vh;
  padding-top: 7rem;
}


/* Hero Section */
.blog-hero {
  padding: 3rem 2rem 1rem 2rem;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
}

.blog-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 0.875rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.blog-hero-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--orange);
  border-radius: 50%;
}

.blog-hero h1 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 3.5rem;
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.blog-hero p {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* Category Nav
   /style.css styles the bare `nav` element (the floating white navbar pill: 1236px
   cap, white fill, border, 16px radius, shadow). Any <nav> on the page inherits it,
   so this filter row has to reset those props back out. Resetting here, NOT by
   scoping the global rule — every page on the site depends on that rule as-is. */
.category-nav {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  padding: 0 2rem 3rem;
  flex-wrap: wrap;
  max-width: none;
  background: none;
  backdrop-filter: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transition: none;
}

.category-nav a {
  padding: 0.6rem 1.25rem;
  border-radius: 2rem;
  font-size: 0.9rem;
  font-weight: 500;
  background: white;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.category-nav a:hover,
.category-nav a.active {
  background: var(--forest);
  color: white;
  border-color: var(--forest);
}

/* Featured Article */
.featured {
  max-width: 1000px;
  margin: 0 auto 4rem;
  padding: 0 2rem;
}

.featured-card {
  background: white;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.featured-image {
  background: linear-gradient(135deg, var(--forest) 0%, #1a2e24 100%);
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.featured-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f8f8f8;
}

.featured-image svg {
  width: 80px;
  height: 80px;
  color: white;
  opacity: 0.5;
}

.featured-content {
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.featured-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--orange);
  font-weight: 600;
  margin-bottom: 1rem;
}

.featured-label::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--orange);
  border-radius: 50%;
}

.featured-content h2 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.featured-content p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.featured-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Article Grid */
.articles-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem 5rem;
}

.articles-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.articles-header h2 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 400;
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2rem;
}

.article-card {
  background: white;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transition: transform 0.2s, box-shadow 0.2s;
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.article-card-image {
  height: 180px;
  background: linear-gradient(135deg, var(--forest) 0%, #1a2e24 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.article-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #f8f8f8;
}

.article-card-image svg {
  width: 48px;
  height: 48px;
  color: white;
  opacity: 0.4;
}

.article-card-content {
  padding: 1.5rem;
}

.article-category {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--orange);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.article-card-content h3 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.article-card-content p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Single Article */
.article-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
}

.article-page .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.article-page .back-link:hover { color: var(--forest); }

/* Same story as .category-nav: /style.css styles the bare `header` element as the
   fixed site navbar (position:fixed; top/left/right:0; z-index:100), and this post
   masthead is a <header>. Reset those props so it lays out in the flow. */
.article-header {
  position: static;
  z-index: auto;
  padding: 0;
  transition: none;
  text-align: center;
  margin-bottom: 3rem;
}

.article-header .article-category { margin-bottom: 1rem; }

.article-header h1 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 3rem;
  font-weight: 400;
  line-height: 1.15;
  margin-bottom: 1.5rem;
}

.article-header .article-meta {
  font-size: 0.95rem;
}

/* Article Hero Image */
.article-hero-image {
  margin-bottom: 3rem;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 px 2px rgba(0,0,0,0.1);
}

.article-hero-image img {
  width: 100%;
  height: auto;
  display: block;
}

.article-hero-image figcaption {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: white;
  text-align: center;
  font-style: italic;
}

.article-body {
  font-size: 1.1rem;
  line-height: 1.8;
}

.article-body h2 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 1.75rem;
  margin: 2.5rem 0 1rem;
}

.article-body h3 {
  font-size: 1.25rem;
  margin: 2rem 0 0.75rem;
}

.article-body p { margin-bottom: 1.5rem; }
.article-body ul { margin: 0 0 1.5rem 1.5rem; }
.article-body li { margin-bottom: 0.5rem; }
.article-body code {
  background: var(--cream-dark);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.article-body pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 1.25rem;
  border-radius: 0.75rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  line-height: 1.6;
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.article-body pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  color: inherit;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* Code block wrapper with copy button */
.code-block-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}

.code-block-wrapper pre {
  margin-bottom: 0;
}

.copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  opacity: 0;
}

.code-block-wrapper:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.copy-btn.copied {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.4);
  color: #4ade80;
}

.copy-btn svg {
  flex-shrink: 0;
}

/* Tables */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  background: white;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  font-size: 0.95rem;
}

.article-body thead {
  background: var(--forest);
  color: white;
}

.article-body th {
  padding: 1rem 1.25rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.article-body td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.article-body tbody tr:last-child td {
  border-bottom: none;
}

.article-body tbody tr:hover {
  background: var(--cream-dark);
}

/* Blockquotes */
.article-body blockquote {
  border-left: 4px solid var(--orange);
  background: white;
  padding: 1.25rem 1.5rem;
  margin: 0 0 1.5rem 0;
  border-radius: 0 0.5rem 0.5rem 0;
  font-style: italic;
  color: var(--text-muted);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.article-body blockquote p:last-child {
  margin-bottom: 0;
}

/* Info/Note boxes */
.article-body .note,
.article-body .info,
.article-body .warning,
.article-body .tip {
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.article-body .note,
.article-body .info {
  background: #e8f4fd;
  border-left: 4px solid #0969da;
}

.article-body .warning {
  background: #fff8e6;
  border-left: 4px solid #d4a72c;
}

.article-body .tip {
  background: #e6f9ed;
  border-left: 4px solid #1a7f37;
}

/* Horizontal rule */
.article-body hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 2.5rem 0;
}

/* Images */
.article-body figure {
  margin: 0 0 2rem;
}

.article-body figure img {
  margin-bottom: 0.75rem;
}

.article-body figcaption {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 0.75rem;
  margin: 1.5rem 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* Definition lists */
.article-body dl {
  margin-bottom: 1.5rem;
}

.article-body dt {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.article-body dd {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

/* Keyboard keys */
.article-body kbd {
  background: var(--cream-dark);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15em 0.4em;
  font-size: 0.85em;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.article-body a {
  color: var(--forest);
  text-decoration: none;
}

/* Related Articles */
.related {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border);
}

.related h2 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
}

/* Category Page */
.category-header {
  text-align: center;
  padding: 4rem 2rem 3rem;
}

.category-header h1 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 2.5rem;
  font-weight: 400;
  margin-bottom: 0.75rem;
}

.category-header p {
  color: var(--text-muted);
  font-size: 1.1rem;
}


/* Responsive */
@media (max-width: 900px) {
  .featured-card { grid-template-columns: 1fr; }
  .featured-image { min-height: 200px; }
}

@media (max-width: 600px) {
  .blog-main { padding-top: 5.5rem; }
  .blog-hero { padding: 2rem 1.5rem 1rem; }
  .blog-hero h1 { font-size: 2.25rem; }
  .articles-grid { grid-template-columns: 1fr; }
}

/* CardGroup Component */
.card-group {
  display: grid;
  grid-template-columns: repeat(var(--card-cols, 3), 1fr);
  gap: 1rem;
  margin: 2rem 0;
}

.doc-card {
  background: white;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border);
  border-top: 3px solid var(--card-border-color, #10b981);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

a.doc-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.doc-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--card-border-color, #10b981);
  padding: 1.25rem 1.25rem 0.75rem;
}

.doc-card-image {
  background: #1a1a1a;
  margin: 0 1.25rem;
  border-radius: 0.5rem;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.doc-card-image img,
.doc-card-image video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.doc-card-stats {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.doc-card-stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.doc-card-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.doc-card-stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--card-border-color, #10b981);
  line-height: 1.1;
}

.doc-card-progress {
  padding: 0 1.25rem 1.25rem;
  margin-top: auto;
}

.doc-card-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.doc-card-progress-header span:first-child {
  color: var(--text-muted);
}

.doc-card-progress-bar {
  height: 6px;
  background: var(--cream-dark);
  border-radius: 3px;
  overflow: hidden;
}

.doc-card-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

@media (max-width: 900px) {
  .card-group {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .card-group {
    grid-template-columns: 1fr;
  }
}
