/* ═══════════════════════════════════════════════════
   KAVE — Blog Single Article Page
   CMS-friendly: all blocks are optional, layout
   never breaks if a block is missing.
   ═══════════════════════════════════════════════════ */

.blog-single {
  padding-top: 80px;
  background: var(--color-bg-alt);
  color: var(--color-text);
}

/* ── Reading Progress Bar ── */
.reading-progress {
  position: fixed;
  top: var(--header-h, 80px);
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 999;
  background: transparent;
  pointer-events: none;
}

.reading-progress .bar {
  height: 100%;
  width: 0%;
  background: var(--color-text);
  transition: width 0.1s linear;
  will-change: width;
}

/* ── Article Hero ── */
.article-hero {
  padding: 48px var(--gutter) 40px;
  max-width: 900px;
  margin: 0 auto;
}

.article-hero .back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 32px;
  transition: color var(--duration-fast);
}

.article-hero .back-link:hover { color: var(--color-text); }
.article-hero .back-link svg { width: 14px; height: 14px; }

.article-hero .article-meta-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.article-hero .article-meta-bar .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

.article-hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1.1;
  font-weight: 400;
  letter-spacing: -0.6px;
  margin-bottom: 20px;
}

.article-hero .article-lead {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--color-text-muted);
  max-width: 720px;
}

/* ── Cover Image (optional — page works without it) ── */
.article-cover {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.article-cover .cover-wrap {
  width: 100%;
  overflow: hidden;
  line-height: 0;
}

.article-cover img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

/* ── Article Body — CMS content container ── */
.article-body {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px var(--gutter) 80px;
}

/* Base text styles — CMS will output these tags */
.article-body h2 {
  font-family: var(--font-heading);
  font-size: clamp(24px, 2.6vw, 36px);
  line-height: 1.15;
  font-weight: 400;
  letter-spacing: -0.4px;
  margin: 56px 0 18px;
}

.article-body h2:first-child { margin-top: 0; }

.article-body h3 {
  font-family: var(--font-heading);
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.2;
  font-weight: 400;
  letter-spacing: -0.3px;
  margin: 40px 0 14px;
}

.article-body p {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  color: var(--color-text);
  margin: 0 0 20px;
}

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

.article-body strong {
  font-weight: 600;
}

.article-body a {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--color-line);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--duration-fast);
}

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

/* Unordered / ordered lists from CMS */
.article-body ul,
.article-body ol {
  margin: 0 0 24px;
  padding-left: 24px;
}

.article-body li {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  margin-bottom: 8px;
}

.article-body ul li { list-style: disc; }
.article-body ol li { list-style: decimal; }

/* ── Inline image — single (optional) ── */
.article-body .img-block {
  margin: 40px 0;
  line-height: 0;
}

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

.article-body .img-block .caption {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 12px;
  line-height: 1.5;
  text-align: center;
}

/* ── Inline image — two-up side by side (optional) ── */
.article-body .img-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 40px 0;
  line-height: 0;
}

.article-body .img-row img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.article-body .img-row .caption {
  grid-column: 1 / -1;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 4px;
  line-height: 1.5;
  text-align: center;
}

/* ── Wide image — breaks out of column (optional) ── */
.article-body .img-wide {
  margin: 48px calc(-1 * (50vw - 450px + var(--gutter)));
  line-height: 0;
}

.article-body .img-wide img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 560px;
  object-fit: cover;
}

.article-body .img-wide .caption {
  max-width: 900px;
  margin: 12px auto 0;
  padding: 0 var(--gutter);
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.5;
  text-align: center;
}

/* ── Blockquote (optional) ── */
.article-body blockquote {
  margin: 40px 0;
  padding: 0 0 0 28px;
  border-left: 3px solid var(--color-text);
}

.article-body blockquote p {
  font-family: var(--font-heading);
  font-size: 22px;
  line-height: 1.4;
  color: var(--color-text);
  font-weight: 400;
  margin: 0;
}

/* ── Callout box (optional) ── */
.article-body .callout {
  background: var(--color-bg);
  padding: 28px 28px;
  margin: 36px 0;
  border-left: 3px solid var(--color-text);
}

.article-body .callout h4 {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.article-body .callout p {
  font-size: 15px;
  margin: 0;
}

/* ── Numbered steps (optional) ── */
.article-body .step-block {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 20px;
  align-items: start;
  margin: 36px 0;
  padding: 28px 0;
  border-top: 1px solid var(--color-line);
}

.article-body .step-block .step-num {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 400;
  color: var(--color-text-muted);
  line-height: 1;
  padding-top: 2px;
}

.article-body .step-block h3 {
  margin: 0 0 8px;
}

.article-body .step-block p {
  font-size: 15px;
}

/* ── Tags / Share (bottom) ── */
.article-footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 var(--gutter) 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--color-line);
  padding-top: 28px;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.article-tags span {
  padding: 7px 14px;
  border: 1px solid var(--color-line);
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--color-text-muted);
}

.article-share {
  display: flex;
  align-items: center;
  gap: 14px;
}

.article-share span {
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 500;
}

.article-share a {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--color-line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  text-decoration: none;
  transition: background var(--duration-base) var(--ease), color var(--duration-base) var(--ease), border-color var(--duration-base) var(--ease);
}

.article-share a:hover {
  background: var(--color-text);
  color: #fff;
  border-color: var(--color-text);
}

.article-share a svg { width: 14px; height: 14px; }

/* ── Related Articles ── */
.related-articles {
  padding: 60px 0 80px;
  border-top: 1px solid var(--color-line);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  padding: 0 var(--gutter);
}

/* Reuses .blog-card styles from blog-archive.css, but scoped fallback here */
.related-articles .r-card {
  text-decoration: none;
  color: inherit;
  display: block;
}

.related-articles .r-media {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #f0f0f0;
  margin-bottom: 16px;
  line-height: 0;
}

.related-articles .r-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease);
}

.related-articles .r-card:hover .r-media img { transform: scale(1.05); }

.related-articles .r-meta {
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 10px;
}

.related-articles .r-title {
  font-family: var(--font-heading);
  font-size: 20px;
  line-height: 1.2;
  font-weight: 400;
  letter-spacing: -0.2px;
  background-image: linear-gradient(var(--color-text), var(--color-text));
  background-size: 0 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.7s var(--ease);
  display: inline;
  padding-bottom: 3px;
}

.related-articles .r-card:hover .r-title { background-size: 100% 1px; }

/* ═══ Responsive ═══ */
@media (max-width: 960px) {
  .article-hero { padding: 40px var(--gutter) 32px; }
  .article-body { padding: 40px var(--gutter) 60px; }
  .article-body .img-wide { margin-left: -16px; margin-right: -16px; }
  .related-grid { grid-template-columns: repeat(2, 1fr); gap: 28px; }
}

@media (max-width: 760px) {
  .blog-single { padding-top: 60px; }
  .reading-progress { top: var(--header-h, 60px); }
  .article-hero h1 { font-size: 28px; }
  .article-hero .article-lead { font-size: 15px; }
  .article-body p,
  .article-body li { font-size: 15px; }
  .article-body h2 { font-size: 24px; margin-top: 40px; }
  .article-body h3 { font-size: 20px; }
  .article-body .img-row { grid-template-columns: 1fr; }
  .article-body .img-wide { margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); }
  .article-body .step-block { grid-template-columns: 36px 1fr; gap: 14px; }
  .article-footer { flex-direction: column; align-items: flex-start; }
  .related-grid { grid-template-columns: 1fr; gap: 32px; }
  .related-articles { padding: 48px 0 60px; }
}
