/* ============================================================
   blog.css — Kingswell Journal
   Listing, cards and article pages.

   Loaded by includes/header.php only on blog pages (a page sets
   $kwBlogCss = true before requiring the header), so the rest of
   the site pays nothing for it.

   Every colour, radius, shadow, font and easing curve below comes
   from the :root tokens in style.css, so the journal reads as part
   of the same house style: navy ink, gold accents, ivory paper.
   ============================================================ */

/* ------------------------------------------------------------
   1. SHARED CARD FURNITURE
   ------------------------------------------------------------ */
.blog-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--navy);
  background: var(--grad-cta);
  border-radius: 100px;
  padding: 0.4rem 0.9rem;
  box-shadow: 0 6px 16px -8px rgba(201, 162, 75, 0.8);
}

.blog-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.1rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: #6d6d6d;
  margin-top: 1rem;
}
.blog-meta i {
  color: var(--gold-deep);
  margin-right: 0.35rem;
}

.blog-readmore {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.2rem;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--gold-deep);
}
.blog-readmore i {
  transition: transform 0.35s ease;
}

/* ------------------------------------------------------------
   2. FEATURED POST
   ------------------------------------------------------------ */
.section-blog-featured {
  background: var(--grad-soft);
}

.blog-featured {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: stretch;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition:
    transform 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.45s ease;
}
.blog-featured:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  color: inherit;
}

.blog-featured-media {
  position: relative;
  overflow: hidden;
  min-height: 340px;
  background: var(--beige);
}
.blog-featured-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.blog-featured:hover .blog-featured-media img {
  transform: scale(1.05);
}

.blog-featured-body {
  padding: 2.6rem 2.8rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.blog-featured-body h3 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.4vw, 2.15rem);
  color: var(--navy);
  margin: 1.1rem 0 0.85rem;
  line-height: 1.18;
}
.blog-featured-body p {
  color: #5a5a5a;
  margin: 0;
  font-size: 1rem;
}
.blog-featured:hover .blog-readmore i {
  transform: translateX(4px);
}

/* ------------------------------------------------------------
   3. CATEGORY FILTERS
   ------------------------------------------------------------ */
.blog-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin: 0 0 2.6rem;
}

.blog-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
  background: #fff;
  border: 1.5px solid rgba(22, 40, 63, 0.14);
  border-radius: 100px;
  padding: 0.55rem 1.2rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.blog-filter span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold-deep);
  background: var(--cream);
  border-radius: 100px;
  padding: 0.1rem 0.5rem;
  transition: all 0.3s ease;
}
.blog-filter:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}
.blog-filter.active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--ivory);
}
.blog-filter.active span {
  background: rgba(255, 255, 255, 0.14);
  color: var(--gold-light);
}

/* ------------------------------------------------------------
   4. POST GRID
   ------------------------------------------------------------ */
.section-blog-grid {
  background: var(--ivory);
}

/* Three articles to a row on desktop, two on tablets, one on phones —
   fixed tracks rather than auto-fill so the row count never drifts with
   the container width. */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
}

.blog-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.45s ease,
    border-color 0.45s ease;
}
.blog-card.blog-hidden {
  display: none;
}
.blog-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
  border-color: rgba(201, 162, 75, 0.4);
}
.blog-card > a {
  display: block;
  height: 100%;
}

.blog-card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--beige);
}
.blog-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.blog-card:hover .blog-card-media img {
  transform: scale(1.06);
}
.blog-card-media .blog-chip {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
}

.blog-card-body {
  padding: 1.6rem 1.7rem 1.9rem;
}
.blog-card-body h3 {
  font-family: var(--font-display);
  font-size: 1.28rem;
  color: var(--navy);
  line-height: 1.25;
  margin: 0 0 0.7rem;
}
.blog-card-body p {
  font-size: 0.94rem;
  color: #5f5f5f;
  margin: 0;
}
.blog-card:hover .blog-readmore i {
  transform: translateX(4px);
}

.blog-empty-filter,
.blog-solo-note {
  text-align: center;
  color: #6d6d6d;
  font-size: 0.98rem;
  margin: 2.5rem 0 0;
}

/* ------------------------------------------------------------
   5. ARTICLE PAGE — layout
   ------------------------------------------------------------ */
.section-blog-post {
  background: var(--ivory);
  padding-top: 4rem;
}

.blog-post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 3.5rem;
  align-items: start;
}

.blog-post-hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.4rem;
  margin-top: 1.6rem;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.72);
}
.blog-post-hero-meta i {
  color: var(--gold-light);
  margin-right: 0.4rem;
}

/* ------------------------------------------------------------
   6. ARTICLE BODY TYPOGRAPHY
   ------------------------------------------------------------ */
.blog-article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 3rem 3.2rem;
  min-width: 0;
}

.blog-article-hero {
  margin: 0 0 2.2rem;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--beige);
}
/* Cropped to a consistent banner rather than following the source
   file's own proportions — the image library mixes square and
   landscape, and a square one would otherwise push the article text
   most of a screen down the page. */
.blog-article-hero img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.blog-article h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  color: var(--navy);
  margin: 2.8rem 0 1rem;
  scroll-margin-top: 110px;
}
.blog-article h2:first-child {
  margin-top: 0;
}
.blog-article h3 {
  font-family: var(--font-display);
  font-size: clamp(1.22rem, 2vw, 1.5rem);
  color: var(--navy);
  margin: 2rem 0 0.8rem;
  scroll-margin-top: 110px;
}
.blog-article h4 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  color: var(--navy-soft);
  margin: 1.6rem 0 0.6rem;
}

.blog-article p {
  font-size: 1.02rem;
  line-height: 1.85;
  color: #4a4a4a;
  margin: 0 0 1.25rem;
}
.blog-article ul,
.blog-article ol {
  margin: 0 0 1.5rem;
  padding-left: 1.3rem;
}
.blog-article li {
  font-size: 1.02rem;
  line-height: 1.8;
  color: #4a4a4a;
  margin-bottom: 0.6rem;
}
.blog-article ul li::marker {
  color: var(--gold-deep);
}
.blog-article ol li::marker {
  color: var(--gold-deep);
  font-weight: 700;
}
.blog-article strong {
  color: var(--navy);
  font-weight: 700;
}

.blog-article hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 2.6rem 0;
  opacity: 0.6;
}

.blog-article figure {
  margin: 2rem 0;
}
.blog-article figure img,
.blog-article > img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}
.blog-article figcaption {
  font-size: 0.85rem;
  color: #7b7b7b;
  text-align: center;
  margin-top: 0.7rem;
  font-style: italic;
}

/* The brand's internal-link treatment, reused inside articles */
.blog-article .decorated-link {
  color: var(--gold-deep);
  font-weight: 600;
  background-image: linear-gradient(var(--gold), var(--gold));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  transition:
    background-size 0.3s ease,
    color 0.3s ease;
}
.blog-article .decorated-link:hover {
  color: var(--navy);
  background-size: 100% 2px;
}

/* Pull-quote / tip block */
.blog-article blockquote {
  position: relative;
  margin: 2.2rem 0;
  padding: 1.7rem 1.9rem 1.7rem 3.4rem;
  background: var(--cream);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.blog-article blockquote::before {
  content: "\201C";
  position: absolute;
  left: 1.1rem;
  top: 0.6rem;
  font-family: var(--font-display);
  font-size: 3.2rem;
  line-height: 1;
  color: var(--gold);
  opacity: 0.55;
}
.blog-article blockquote p {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-style: italic;
  color: var(--navy);
  line-height: 1.7;
}
.blog-article blockquote p + p {
  margin-top: 0.8rem;
}

/* Data tables — wrapper scrolls so the page body never does */
.blog-table-wrap {
  overflow-x: auto;
  margin: 2rem 0;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}
.blog-article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
  background: #fff;
}
/* Inside the scroll box a table keeps readable columns and lets the
   box scroll, rather than squeezing four columns into a phone width. */
.blog-table-wrap table {
  min-width: 460px;
}
.blog-article table th {
  background: var(--navy);
  color: var(--ivory);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  padding: 0.95rem 1.1rem;
}
.blog-article table td {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--line);
  color: #4a4a4a;
  vertical-align: top;
}
.blog-article table tr:last-child td {
  border-bottom: 0;
}
.blog-article table tbody tr:nth-child(even) {
  background: rgba(251, 243, 226, 0.5);
}

/* ------------------------------------------------------------
   7. TABLE OF CONTENTS
   ------------------------------------------------------------ */
.blog-toc {
  background: var(--cream);
  border: 1px solid rgba(201, 162, 75, 0.28);
  border-radius: var(--r-md);
  padding: 1.6rem 1.8rem;
  margin: 0 0 2.4rem;
}
.blog-toc-title {
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin: 0 0 0.9rem;
}
.blog-toc ol {
  margin: 0;
  padding-left: 1.15rem;
}
.blog-toc li {
  font-size: 0.94rem;
  line-height: 1.6;
  margin-bottom: 0.5rem;
  color: #4a4a4a;
}
.blog-toc li::marker {
  color: var(--gold-deep);
  font-weight: 700;
}
.blog-toc a {
  color: var(--navy);
  transition: color 0.25s ease;
}
.blog-toc a:hover,
.blog-toc a.active {
  color: var(--gold-deep);
  font-weight: 600;
}

/* The contents list exists twice: once in the sidebar for desktop, once
   inside the article for narrow screens, where the sidebar drops below
   the article and a contents list there would be pointless. Exactly one
   is ever visible. */
.blog-toc-inline {
  display: none;
}
.blog-toc-side {
  margin: 0;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}
.blog-toc-side ol {
  counter-reset: toc;
  list-style: none;
  padding-left: 0;
}
.blog-toc-side li {
  counter-increment: toc;
  position: relative;
  padding-left: 1.6rem;
  margin-bottom: 0.55rem;
}
.blog-toc-side li::before {
  content: counter(toc);
  position: absolute;
  left: 0;
  top: 0.05rem;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold-deep);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(201, 162, 75, 0.35);
  border-radius: 50%;
  width: 1.15rem;
  height: 1.15rem;
  display: grid;
  place-items: center;
  transition: all 0.25s ease;
}
.blog-toc-side a {
  display: block;
  line-height: 1.45;
}
.blog-toc-side li:has(a.active)::before {
  background: var(--grad-cta);
  border-color: transparent;
  color: var(--navy);
}

/* ------------------------------------------------------------
   8. FAQ BLOCK
   ------------------------------------------------------------ */
.blog-faq {
  margin-top: 3rem;
  padding-top: 2.4rem;
  border-top: 1px solid var(--line);
}
.blog-faq h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  color: var(--navy);
  margin: 0 0 1.4rem;
}

.blog-faq-item {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  margin-bottom: 0.85rem;
  overflow: hidden;
  background: #fff;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}
.blog-faq-item[open] {
  border-color: rgba(201, 162, 75, 0.45);
  box-shadow: var(--shadow-sm);
}
.blog-faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 1.1rem 3rem 1.1rem 1.3rem;
  position: relative;
  font-family: var(--font-display);
  font-size: 1.06rem;
  color: var(--navy);
  line-height: 1.45;
}
.blog-faq-item summary::-webkit-details-marker {
  display: none;
}
.blog-faq-item summary::after {
  content: "\f078";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--gold-deep);
  transition: transform 0.3s ease;
}
.blog-faq-item[open] summary::after {
  transform: translateY(-50%) rotate(180deg);
}
.blog-faq-answer {
  padding: 0 1.3rem 1.3rem;
}
.blog-faq-answer p {
  margin: 0 0 0.8rem;
  font-size: 0.98rem;
  line-height: 1.75;
  color: #4a4a4a;
}
.blog-faq-answer p:last-child {
  margin-bottom: 0;
}

/* ------------------------------------------------------------
   9. AUTHOR BOX
   ------------------------------------------------------------ */
.blog-author {
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
  margin-top: 3rem;
  padding: 1.8rem;
  background: var(--grad-dark);
  border-radius: var(--r-md);
}
.blog-author-avatar {
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--grad-cta);
  color: var(--navy);
  font-family: var(--font-display);
  font-size: 1.4rem;
}
.blog-author h4 {
  font-family: var(--font-display);
  color: #fff;
  font-size: 1.15rem;
  margin: 0 0 0.35rem;
}
.blog-author p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.72);
}

/* ------------------------------------------------------------
   10. SIDEBAR
   ------------------------------------------------------------ */
.blog-sidebar {
  position: sticky;
  top: 110px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.blog-widget {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.6rem 1.7rem;
  box-shadow: var(--shadow-sm);
}
.blog-widget-title {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin: 0 0 1.1rem;
}

.blog-widget-post {
  display: flex;
  gap: 0.9rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}
.blog-widget-post:first-child {
  padding-top: 0;
}
.blog-widget-post:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.blog-widget-post img {
  flex: 0 0 auto;
  width: 66px;
  height: 66px;
  object-fit: cover;
  border-radius: var(--r-xs);
  background: var(--beige);
}
.blog-widget-post h5 {
  font-family: var(--font-display);
  font-size: 0.96rem;
  line-height: 1.35;
  color: var(--navy);
  margin: 0 0 0.3rem;
  transition: color 0.25s ease;
}
.blog-widget-post:hover h5 {
  color: var(--gold-deep);
}
.blog-widget-post small {
  font-size: 0.78rem;
  color: #7b7b7b;
}

.blog-widget-cta {
  background: var(--grad-dark);
  border: 0;
  text-align: center;
}
.blog-widget-cta .overline {
  color: var(--gold-light);
  margin-bottom: 0;
}
.blog-widget-cta h4 {
  font-family: var(--font-display);
  color: #fff;
  font-size: 1.25rem;
  margin: 0.5rem 0 0.6rem;
}
.blog-widget-cta p {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
  margin: 0 0 1.3rem;
}

.blog-widget-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.blog-tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--navy);
  background: var(--cream);
  border: 1px solid rgba(201, 162, 75, 0.25);
  border-radius: 100px;
  padding: 0.35rem 0.85rem;
  transition: all 0.25s ease;
}
.blog-tag:hover {
  background: var(--navy);
  color: var(--ivory);
  border-color: var(--navy);
}

/* ------------------------------------------------------------
   11. RELATED POSTS STRIP
   ------------------------------------------------------------ */
.section-blog-related {
  background: var(--grad-soft);
}

/* ------------------------------------------------------------
   12. RESPONSIVE
   ------------------------------------------------------------ */
@media (max-width: 1100px) {
  .blog-post-layout {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  .blog-sidebar {
    position: static;
  }
  /* Swap which copy of the contents list is shown. */
  .blog-toc-inline {
    display: block;
  }
  .blog-toc-side {
    display: none;
  }
}

@media (max-width: 900px) {
  .blog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .blog-featured {
    grid-template-columns: 1fr;
  }
  .blog-featured-media {
    min-height: 240px;
    aspect-ratio: 16 / 9;
  }
  .blog-featured-body {
    padding: 2rem 1.8rem 2.2rem;
  }
}

@media (max-width: 768px) {
  .section-blog-post {
    padding-top: 2.5rem;
  }
  .blog-article {
    padding: 2rem 1.5rem;
    border-radius: var(--r-md);
  }
  .blog-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .blog-filters {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
  }
  .blog-filter {
    flex: 0 0 auto;
  }
  .blog-article blockquote {
    padding: 1.4rem 1.2rem 1.4rem 2.8rem;
  }
  .blog-author {
    flex-direction: column;
    gap: 1rem;
  }
}
