/* Copyright 2026 Renofy Ltd. All rights reserved. */
/* Blog – Listing and Article Detail – Mobile First */

/* ============================================
   Page Layout
   ============================================ */
body.page-blog main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}

body.page-blog main > .footer {
  margin-top: auto;
}

/* ============================================
   Shared Container
   ============================================ */
.blog-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

/* ============================================
   Headings – display font, tight tracking, primary colour.
   Sizes and margins are set per-selector below.
   ============================================ */
.blog-header h1,
.blog-article-header h1,
.blog-article-body h2,
.blog-article-faqs > h2,
.blog-article-related > h2 {
  font-family: var(--font-display);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-text-primary);
}

.blog-card__title,
.blog-article-body h3,
.blog-article-faqs .faq-item summary h3 {
  font-family: var(--font-display);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-text-primary);
}

/* ============================================
   Listing Page – Header
   ============================================ */
.blog-header {
  text-align: center;
  margin-bottom: 2rem;
}

.blog-header h1 {
  margin: 0 0 0.5rem;
}

.blog-header p {
  font-size: var(--font-size-lg);
  color: var(--color-text-mid);
  font-weight: var(--font-weight-medium);
  margin: 0 auto;
  max-width: 600px;
}

/* ============================================
   Article Cards (listing + related articles)
   ============================================ */
.blog-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.blog-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-base);
  background: var(--color-white);
  color: var(--color-text-primary);
  text-decoration: none;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition:
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
}

.blog-card__image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
  object-fit: cover;
}

.blog-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.25rem;
}

.blog-card__title {
  font-size: var(--font-size-lg);
  margin: 0 0 0.75rem;
}

.blog-card__excerpt {
  font-size: var(--font-size-base);
  color: var(--color-text-mid);
  line-height: var(--line-height-normal);
  margin: 0 0 1.25rem;
}

/* Author · Date · Read length – pinned to the bottom of the card via
   margin-top:auto so the hairline rule + meta line up across cards of
   different excerpt lengths. Requires .blog-card and .blog-card__body
   to be flex columns. */
.blog-card__meta {
  /* Locked at 14px on every breakpoint – matches the article byline. */
  font-size: 0.875rem;
  color: var(--color-text-mid);
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.blog-card__sep,
.blog-article-byline__sep {
  margin: 0 0.25rem;
}

.blog-empty {
  text-align: center;
  color: var(--color-text-mid);
}

/* ============================================
   Detail Page – Breadcrumbs
   ============================================ */
.blog-breadcrumbs {
  margin-bottom: 1.5rem;
}

.blog-breadcrumbs__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 0.25rem;
  font-size: var(--font-size-sm);
}

.blog-breadcrumbs__item + .blog-breadcrumbs__item::before {
  content: "/";
  margin: 0 0.25rem;
  color: var(--color-text-mid);
}

.blog-breadcrumbs__link {
  color: var(--color-text-mid);
  text-decoration: none;
}

.blog-breadcrumbs__item--current {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-medium);
}

/* ============================================
   Detail Page – Article Header, Byline, Hero
   ============================================ */
.blog-article-header h1 {
  font-size: var(--font-size-4xl);
  line-height: var(--line-height-tight);
  margin: 0 0 0.75rem;
}

.blog-article-byline {
  /* Locked at 14px on every breakpoint – same reasoning as body text. */
  font-size: 0.875rem;
  color: var(--color-text-mid);
  margin: 0 0 1.5rem;
}

.blog-article-author,
.blog-card__author {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.blog-article-hero {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  margin-bottom: 1.5rem;
}

/* ============================================
   Detail Page – Article Body
   ============================================
   Scoped to .blog-article-body. Author-facing classes: .blog-cta,
   .blog-citation, .blog-references. */

/* Body text – shared by article paragraphs/list items and FAQ answers.
   Locked at 16px on every breakpoint (literal rem bypasses the mobile
   scale on the --font-size-* variables). */
.blog-article-body p,
.blog-article-body li,
.blog-article-faqs .faq-item p {
  font-size: 1rem;
  line-height: var(--line-height-loose);
  color: var(--color-text-mid);
  font-weight: var(--font-weight-regular);
}

.blog-article-body p {
  margin: 0 0 1.25rem;
}

.blog-article-body > * + h2 {
  margin-top: 4.5rem;
}

.blog-article-body > * + h3 {
  margin-top: 2.5rem;
}

.blog-article-body h2 {
  font-size: var(--font-size-xl);
  line-height: var(--line-height-tight);
  margin: 2rem 0 0.75rem;
}

.blog-article-body h3 {
  /* Locked at 16px on every breakpoint – same reasoning as body text. */
  font-size: 1rem;
  line-height: var(--line-height-tight);
  margin: 1.75rem 0 0.5rem;
}

.blog-article-body ul,
.blog-article-body ol {
  margin: 0 0 1.5rem;
  padding-left: 1.5rem;
}

.blog-article-body li {
  margin-bottom: 0.5rem;
}

.blog-article-body strong,
.blog-article-body em {
  color: var(--color-text-primary);
}

.blog-article-body strong {
  font-weight: var(--font-weight-semibold);
}

.blog-article-body em {
  font-style: italic;
}

/* In-body links */
.blog-article-body a {
  color: var(--color-pink);
  text-decoration: none;
  transition: color var(--transition-fast);
}

/* Blockquote – large pink open-quote glyph, italic body. */
.blog-article-body blockquote {
  position: relative;
  margin: 1.75rem 0;
  padding: 0.5rem 1.5rem 0.5rem 3rem;
  border-left: 3px solid var(--color-pink);
}

.blog-article-body blockquote::before {
  content: "\201C";
  position: absolute;
  top: -0.5rem;
  left: 0.75rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: var(--font-size-6xl);
  line-height: var(--line-height-tight);
  color: var(--color-pink);
  opacity: 0.3;
}

.blog-article-body blockquote p {
  font-style: italic;
  color: var(--color-text-primary);
  font-size: var(--font-size-lg);
}

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

/* Tables – header band, zebra rows. Wrap in .blog-table-wrap inside the
   body fragment for horizontal scroll on narrow screens. */
.blog-table-wrap {
  margin: 1.75rem 0;
  overflow-x: auto;
  border-radius: var(--radius-base);
  border: 1px solid var(--color-border);
}

.blog-article-body table {
  width: 100%;
  border-collapse: collapse;
  /* Locked at 14px on every breakpoint – same reasoning as body text. */
  font-size: 0.875rem;
}

.blog-article-body th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  background: var(--color-bg-surface);
  border-bottom: 2px solid var(--color-border);
}

.blog-article-body td {
  padding: 1rem;
  vertical-align: top;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-mid);
  line-height: var(--line-height-normal);
}

.blog-article-body tbody tr:nth-child(even) td {
  background: var(--color-bg-light);
}

/* Inline images and figures (future-proofing). */
.blog-article-body img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-base);
  border: 1px solid var(--color-border);
  margin: 1.5rem 0;
}

.blog-article-body figure {
  margin: 1.5rem 0;
}

.blog-article-body figcaption {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  margin-top: 0.5rem;
  text-align: center;
}

/* Closing call-to-action block. */
.blog-article-body .blog-cta {
  margin: 3rem 0 1rem;
  padding: 1.5rem;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-pink);
  border-radius: var(--radius-base);
  color: var(--color-text-primary);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-loose);
}

/* Inline superscript citation marker. */
.blog-article-body .blog-citation {
  font-size: 0.75em;
  vertical-align: super;
  line-height: 0;
  margin-left: 0.1em;
  white-space: nowrap;
}

/* Source list at the end of an article – long URLs wrap on narrow screens. */
.blog-article-body .blog-references {
  font-size: var(--font-size-sm);
  padding-left: 1.5rem;
}

.blog-article-body .blog-references li {
  margin-bottom: 0.75rem;
  overflow-wrap: anywhere;
}

/* ============================================
   Detail Page – FAQs
   ============================================ */
.blog-article-faqs {
  margin: 3rem 0 1rem;
}

.blog-article-faqs > h2,
.blog-article-related > h2 {
  font-size: var(--font-size-2xl);
}

.blog-article-faqs > h2 {
  margin: 0 0 0.5rem;
}

.blog-article-faqs .faq-item {
  border-bottom: 1px solid var(--color-border);
}

.blog-article-faqs .faq-item:last-child {
  border-bottom: none;
}

.blog-article-faqs .faq-item summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  padding: 1.25rem 0;
  -webkit-tap-highlight-color: transparent;
}

.blog-article-faqs .faq-item summary::-webkit-details-marker {
  display: none;
}

.blog-article-faqs .faq-item summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--color-pink);
  border-bottom: 2px solid var(--color-pink);
  transform: rotate(-45deg);
  flex-shrink: 0;
  margin-right: 1.5rem;
  transition: transform var(--transition-fast);
}

.blog-article-faqs .faq-item[open] summary::before {
  transform: rotate(45deg);
}

.blog-article-faqs .faq-item summary h3 {
  /* Locked at 16px on every breakpoint – same reasoning as body text. */
  font-size: 1rem;
  margin: 0;
}

.blog-article-faqs .faq-item p {
  margin: 0 0 1.5rem;
}

/* ============================================
   Detail Page – Related Articles
   ============================================ */
.blog-article-related {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.blog-article-related > h2 {
  margin: 0 0 1.25rem;
}

/* ============================================
   Desktop layout
   ============================================ */
@media (min-width: 768px) {
  .blog-container {
    padding-block: 2rem 3rem;
  }

  .blog-card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .blog-article-hero {
    margin-bottom: 2.5rem;
  }
}

/* Desktop side gutter comes from base.css's main padding-inline at this
   breakpoint, so the container hands the horizontal gutter back to base.
   Hover states are also gated here per project convention. */
@media (min-width: 821px) {
  .blog-container {
    padding-inline: 0;
  }

  .blog-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
  }

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

  .blog-article-body a:hover {
    color: var(--color-blue);
  }
}
