/* ============================================================
   SINGLE BLOG POST — single.php
   Hero + 2-col layout (sticky TOC+products / prose).
   Reuses .legal-toc styles from styles.css for the TOC itself;
   this file adds the article-specific bits (hero, meta line,
   sticky aside grouping, product rail).
   Loaded only when is_singular('post').
   ============================================================ */

/* ---------- HERO ---------- */
.article-hero {
  margin: var(--s-4) 0 var(--s-6);
  border-radius: var(--r-3);
  overflow: hidden;
  aspect-ratio: 3 / 1;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.article-hero .article-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- LAYOUT ---------- */
.article-section { padding-top: 0; }

.article-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: var(--s-8);
  padding: var(--s-3) 0 var(--s-9);
  align-items: start;
}
.article-layout--single { grid-template-columns: minmax(0, 1fr); }

/* ---------- ASIDE (sticky TOC + products) ---------- */
.article-aside {
  position: sticky;
  top: calc(var(--header-h) + var(--s-5));
  align-self: start;
  max-height: calc(100vh - var(--header-h) - var(--s-6));
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  font-size: 14px;
}
.article-toc { /* inherits .legal-toc styles; placeholder for overrides */ }

/* ---------- PRODUCT RAIL ---------- */
.article-products ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.article-prod {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.article-prod:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}
.article-prod:hover .article-prod-arrow { transform: translateX(2px); color: var(--accent); }

.article-prod-thumb {
  width: 56px; height: 56px;
  border-radius: var(--r-1);
  overflow: hidden;
  background: var(--bg-soft);
  display: block;
}
.article-prod-img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.article-prod-ph {
  display: block; width: 100%; height: 100%;
  background:
    linear-gradient(135deg, var(--bg-soft) 0%, var(--line) 100%);
}
.article-prod-body {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.article-prod-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-prod-price {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.article-prod-price del { color: var(--muted); margin-right: 4px; font-weight: 400; }
.article-prod-price ins { text-decoration: none; color: var(--accent); font-weight: 600; }
.article-prod-arrow {
  color: var(--ink-3);
  transition: transform .15s ease, color .15s ease;
  flex-shrink: 0;
}

/* ---------- CONTENT ---------- */
.article-content { min-width: 0; }

.article-meta {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: var(--s-3);
}
.article-meta-sep { color: var(--line-strong); }
.article-meta time { color: var(--ink-3); }
.article-meta .cat { font-size: 11px; }
.article-meta-read {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--ink-3);
}

.article-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.6vw, 44px);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 var(--s-5);
  letter-spacing: -0.018em;
  line-height: 1.1;
  text-wrap: balance;
}

.article-content .prose { max-width: none; }
.article-content .prose h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  margin: var(--s-7) 0 var(--s-3);
  letter-spacing: -0.012em;
  scroll-margin-top: calc(var(--header-h) + var(--s-4));
}
.article-content .prose h3 {
  font-size: 18px;
  margin: var(--s-5) 0 var(--s-2);
  scroll-margin-top: calc(var(--header-h) + var(--s-4));
}
.article-content .prose ul,
.article-content .prose ol {
  padding-left: 1.4em;
  margin: 0 0 var(--s-4);
}
.article-content .prose li { margin: 0 0 6px; }
.article-content .prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.article-content .prose figure,
.article-content .prose img { margin: var(--s-5) 0; border-radius: var(--r-3); max-width: 100%; height: auto; }
.article-content .prose blockquote {
  margin: var(--s-5) 0;
  padding: var(--s-4) var(--s-5);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  font-size: 16px;
  color: var(--ink-2);
  border-radius: 0 var(--r-2) var(--r-2) 0;
}
.article-content .prose blockquote p:last-child { margin-bottom: 0; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1024px) {
  .article-layout { grid-template-columns: minmax(0, 1fr); gap: var(--s-5); }
  .article-aside {
    position: static;
    max-height: none;
    overflow: visible;
    padding: var(--s-4) var(--s-5);
    border: 1px solid var(--line);
    border-radius: var(--r-3);
    background: var(--bg-soft);
  }
  .article-products ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-3);
  }
}

@media (max-width: 640px) {
  .article-hero { margin: var(--s-3) 0 var(--s-5); aspect-ratio: 16 / 9; }
  .article-layout { padding: var(--s-2) 0 var(--s-7); }
  .article-aside { padding: var(--s-3) var(--s-4); gap: var(--s-4); }
  .article-products ul { grid-template-columns: 1fr; }
  .article-title { font-size: clamp(24px, 7vw, 32px); }
  .article-content .prose h2 { font-size: 20px; margin-top: var(--s-6); }
  .article-content .prose h3 { font-size: 17px; }
}


/* ============================================================
   Center icons + headings inside Gutenberg icon-grid columns
   (renders correctly even when WP wraps the figure in
   <div class="wp-block-image">).
   ============================================================ */
.article-content .prose figure.aligncenter,
.article-content .prose .wp-block-image > figure.aligncenter {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}
.article-content .prose figure.aligncenter img {
  display: block;
  margin-left: auto;
  margin-right: auto;
}
