/* Blog styles */

html {
  scroll-behavior: smooth;
}

/* Table of Contents */
.table-of-contents {
  background-color: #fcfcfc;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 1rem 2rem;
  margin: 0rem 0 4rem 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.table-of-contents h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #000;
}

.table-of-contents ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.table-of-contents li {
  margin-bottom: 0.5rem;
  font-size: 1.1rem
}

.table-of-contents a {
  color: #333;
  text-decoration: none;
  transition: color 0.2s;
  display: block;
  padding: 0.5rem 0;
}

.table-of-contents a:hover {
  color: #8c1515;
}

/* Hero section */
.chronicle-hero {
  padding: 4rem 0;
  color: #fff;
  background-color: #333;
  position: relative;
}

/* Default left-aligned breadcrumbs for all pages */
.breadcrumbs-container {
  width: 100%;
  margin-bottom: 1rem;
}

/* Center alignment only for post pages */
.chronicle-post-template .breadcrumbs-container {
  text-align: center;
  display: flex;
  justify-content: center;
}

.breadcrumbs {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.chronicle-post-template .breadcrumbs {
  justify-content: center;
}

.breadcrumbs li {
  position: relative;
  margin: 0 5px;
  display: flex;
  align-items: center;
}

.breadcrumbs li a, 
.breadcrumbs li:not(:last-child):after {
  color: white;
}

.breadcrumbs li a {
  text-decoration: none;
}

.breadcrumbs li:not(:last-child):after {
  content: "›";
  margin: 0 5px;
}

.breadcrumbs li:last-child a {
  color: white;
  pointer-events: none;
}


.chronicle-hero-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  padding: 2rem 0;
}


.chronicle-hero-title {
  font-size: 2.8rem;
  font-weight: 700;
  margin-bottom: 1rem;
  font-family: 'Public Sans';
  line-height: 3.6rem;
}

.chronicle-hero-subtitle {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
}

.chronicle-meta {
  margin: 1rem 0;
  font-size: 0.9rem;
  color: #eee;
}

.chronicle-meta span {
  margin-right: 1rem;
}

.chronicle-tags {
  margin-top: 1rem;
}

.tag {
  display: inline-block;
  background-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 0.3rem 0.8rem;
  border-radius: 50px;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background-color 0.3s;
}

.tag:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

/* Blog content */
.chronicle-post {
  padding: 4rem 0;
}

.chronicle-content {
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.7;
}

.chronicle-content h2 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 700;
  font-size: 2rem;
  display: flex;
  text-align: left;
}

.chronicle-content h3 {
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-size: 1.7rem;
}

.chronicle-content p {
  margin-bottom: 2.1rem;
  font-size: 1.22rem;
  color: var(--ink-700);
  margin-top: -10px;
  line-height: 2rem;
}

.chronicle-content img {
  max-width: 100%;
  height: auto;
  margin: 1rem 0 0 0;
  border-radius: 5px;
}

.chronicle-content ul, .chronicle-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.chronicle-content li {
  margin-bottom: 0.5rem;
  list-style: auto;
}

/* Tables: market-report / data-grid styling. Markdown tables otherwise
   render with no borders or padding. Brand-green header, zebra rows,
   tidy cell padding, responsive horizontal scroll on narrow screens. */
.chronicle-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 1rem;
  line-height: 1.5;
  background-color: #ffffff;
  border: 1px solid #e6e6e6;
  border-radius: 6px;
  overflow: hidden;
  display: table;
}
.chronicle-content thead {
  background-color: #235759;
  color: #ffffff;
}
.chronicle-content thead th {
  padding: 0.85rem 1rem;
  font-weight: 700;
  text-align: left;
  font-family: "Public Sans", sans-serif;
  letter-spacing: 0.3px;
  border: none;
  white-space: nowrap;
}
.chronicle-content tbody tr {
  border-bottom: 1px solid #ececec;
}
.chronicle-content tbody tr:last-child {
  border-bottom: none;
}
.chronicle-content tbody tr:nth-child(even) {
  background-color: #f6f8f7;
}
.chronicle-content tbody td {
  padding: 0.75rem 1rem;
  vertical-align: top;
  color: var(--ink-700);
  border: none;
}
/* Right-align cells in columns the author marked with `|---:|` in markdown.
   markdown-it emits style="text-align:right" on those cells; respect it. */
.chronicle-content table th[style*="right"],
.chronicle-content table td[style*="right"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.chronicle-content table th[style*="center"],
.chronicle-content table td[style*="center"] {
  text-align: center;
}
/* Mobile: let very wide tables scroll horizontally inside the article column */
@media (max-width: 640px) {
  .chronicle-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.chronicle-content blockquote {
  border-left: 4px solid #666;
  padding-left: 1.5rem;
  font-style: italic;
  margin: 2rem 0;
}

.chronicle-content code {
  font-family: monospace;
  background-color: #f4f4f4;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
}

.chronicle-content pre {
  background-color: #f4f4f4;
  padding: 1rem;
  border-radius: 5px;
  overflow-x: auto;
  margin: 2rem 0;
}

.chronicle-content pre code {
  background-color: transparent;
  padding: 0;
}

.chronicle-post p strong {
  
  font-weight: 700;
  display: block;
  margin: 3.5rem 0 0.75rem 0;
  line-height: 1.2;
  color: #000;
  border-bottom: 1px solid #eaeaea;
  padding-bottom: 0.5rem;
  
  font-family: 'Public Sans';
  margin-bottom: -20px;
}


/* Featured posts */
.featured-posts {
  padding: 4rem 0;
  background-color: #f9f9f9;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
  width: 100%;
}

/* Use the same card layout for featured posts */
.featured-card {
  border: 1px solid #eee;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
  background: white;
}

.featured-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.featured-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: #FFD700;
  color: #333;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 2;
}

.featured-badge--guide {
  background-color: #235759;
  color: #ffffff;
}

.chronicle-guides-intro {
  margin: 0.5rem 0 0;
  max-width: 100%;
}

.featured-card-image img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

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

.featured-card-content h3 {
  margin-bottom: 0.5rem;
}

.featured-card-content h3 a {
  color: #000;
  text-decoration: none;
  font-weight: 700;
  line-height: 1.8rem;
  font-size: 1.4rem;
}

.featured-card-meta {
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #666;
}

/* Blog list */
.chronicle-list {
  padding: 4rem 0;
}

.chronicle-sidebar-layout {
  display: grid;
  grid-template-columns: 4fr 1fr;
  gap: 3rem;
}

.chronicle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
  width: 100%;
}

.chronicle-card {
  border: 1px solid #eee;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
}

.chronicle-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.chronicle-card-image img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

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

.chronicle-card-content h3 {
  margin-bottom: 0.5rem;
}

.chronicle-card-content h3 a {
  color: #000;
  text-decoration: none;
  font-weight: 700;
  line-height: 1.8rem;
  font-size: 1.4rem;
}

.chronicle-card-meta {
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #666;
}

.read-more {
  display: inline-block;
  color: #1e5456;
  text-decoration: underline;
  font-weight: 600;
  margin-top: 1rem;
  text-transform: uppercase;
  font-size: 0.8rem !important;
}

/* Sidebar */
.chronicle-sidebar {
  padding-top: 2rem;
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section h3 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
}

.category-list, .recent-posts {
  list-style: none;
  padding: 0;
}

.category-list li, .recent-posts li {
  margin-bottom: 0.5rem;
}

.category-list a, .recent-posts a {
  color: #333;
  text-decoration: none;
  transition: color 0.3s;
}

.category-list a:hover, .recent-posts a:hover {
  color: #8c1515;
}

.category-list a.active {
  color: #8c1515;
  font-weight: 600;
}

.post-date {
  display: block;
  font-size: 0.8rem;
  color: #666;
  margin-top: 0.2rem;
}

/* Pagination */
.pagination {
  margin-top: 3rem;
  text-align: center;
}

.pagination ul {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  row-gap: 0.5rem;
  list-style: none;
  padding: 0;
}

.pagination li {
  margin: 0 0.25rem;
}

.pagination a, .pagination span {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid #eee;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
  transition: background-color 0.3s;
}

.pagination a:hover {
  background-color: #f4f4f4;
}

.pagination li.active a {
  background-color: #8c1515;
  color: #fff;
  border-color: #8c1515;
}

.pagination li.disabled span {
  color: #ccc;
  cursor: not-allowed;
}

/* Blog share */
.chronicle-share {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #eee;
  text-align: center;
}

.chronicle-share h3 {
  font-weight: 600;
}

/* Google preferred-source prompt, inside the share block */
.preferred-source {
  margin-top: 1.5rem;
}

.preferred-source-text {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  color: #333;
}

.preferred-source-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: 1px solid #235759;
  border-radius: 999px;
  color: #235759;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}

.preferred-source-btn:hover,
.preferred-source-btn:focus-visible {
  background-color: #235759;
  color: #fff;
}

.share-links {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  justify-content: center;
}

.share-links a {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  text-decoration: none;
  color: #fff;
  background-color: #235759;
  transition: all 0.3s ease;
}

.share-links a:hover {
  background-color: #6e1010;
  transform: translateY(-3px);
}

.share-links svg {
  width: 20px;
  height: 20px;
}

/* Related posts */
.related-posts {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid #eee;
}

/* Back link */
.back-link {
  margin-top: 2rem;
}

.back-link a {
  display: inline-block;
  color: #8c1515;
  text-decoration: none;
  font-weight: 600;
}

/* Media queries */
@media (max-width: 768px) {
  .chronicle-sidebar-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }
  
  .chronicle-grid, .featured-grid {
    grid-template-columns: 1fr;
  }
  
  .chronicle-hero-title {
    font-size: 1.6rem;
    line-height: 2.3rem;
  }
  .chronicle-card-content h3 {
    font-size: 1.4rem;
    line-height: 2rem;
}
.featured-card-content h3 a {
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 2rem;
}
  
  .chronicle-hero-subtitle {
    font-size: 1rem;
  }

  .chronicle-content h2 {
    margin-top: 2rem;
    margin-bottom: 2rem;
    font-weight: 700;
    font-size: 2rem;
    display: flex;
    text-align: left;
    line-height: 2.6rem;
}

.chronicle-content h3 {
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  font-size: 1.7rem;
  display: flex;
  line-height: 2.6rem;
}
.chronicle-card-content h4 {
  font-size: 1.6rem;
  line-height: 2.2rem;
  font-weight: 700;
}

}

/* Responsive grid adjustments for larger screens */
@media (min-width: 769px) and (max-width: 1199px) {
  .chronicle-grid, .featured-grid {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  }
  
  .related-posts .chronicle-grid {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  }
}

@media (min-width: 1200px) {
  .chronicle-grid, .featured-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .related-posts .chronicle-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .chronicle-content {
    max-width: 800px;
  }
  
  .related-posts, .chronicle-share {
    max-width: 100%;
  }
}

@media (min-width: 1600px) {
  .chronicle-grid, .featured-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* CTA inside chronicle content */
.chronicle-content .cta-section {
  background-color: #f0f7f0;
  padding: 2rem;
  border-radius: 12px;
  margin: 3rem 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.chronicle-content .cta-container {
  text-align: center;
}

.chronicle-content .cta-title {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: var(--primary-color, #235759);
}

.chronicle-content .cta-text {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.chronicle-content .cta-button {
  display: inline-block;
  padding: 0.75rem 2rem;
  background-color: #235759;
  color: #fff;
  text-decoration: none;
  border-radius: 50px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.chronicle-content .cta-button:hover {
  background-color: #6e1010;
  transform: translateY(-3px);
}

/* Add script to handle TOC links at the bottom of the page */
.chronicle-content::after {
  content: "";
  display: block;
  height: 0;
  width: 0;
  overflow: hidden;
}

/* Script moved to src/assets/js/chronicle.js */ 
/* Table of contents: full-bleed racing-green band matching the homepage
   chronicle strip. Every article writes "## Table of Contents" followed by
   a list, so #table-of-contents + ul is the whole component. The
   50vw margin/padding pair stretches the background to the viewport edges
   while keeping the text aligned with the content column. */
.chronicle-content #table-of-contents,
.chronicle-content #table-of-contents + ul {
  background: var(--teal-700);
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-left: calc(50vw - 50%);
  padding-right: calc(50vw - 50%);
}

.chronicle-content #table-of-contents {
  /* Rendered as <p class="toc-heading"> (see .eleventy.js), so it carries
     the h2 typography itself rather than inheriting the paragraph rules. */
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  display: flex;
  text-align: left;
  color: #fff;
  /* The TOC is always the first element of the article body; pull it up by
     the article's 4rem top padding so the band sits flush against the hero. */
  margin-top: -4rem;
  margin-bottom: 0;
  padding-top: 3.25rem;
  padding-bottom: 0.5rem;
}

/* Matches the mobile .chronicle-content h2 line-height it had as an h2. */
@media (max-width: 768px) {
  .chronicle-content #table-of-contents {
    line-height: 2.6rem;
  }
}

.chronicle-content #table-of-contents + ul {
  margin-top: 0;
  margin-bottom: 2.75rem;
  padding-top: 0.25rem;
  padding-bottom: 2.5rem;
  /* Keep the list indented relative to the heading: the full-bleed
     padding replaces the default 1.5rem list indent, so add it back. */
  padding-left: calc(50vw - 50% + 1.5rem);
}

.chronicle-content #table-of-contents + ul li::marker {
  color: var(--mint-300);
}

.chronicle-content #table-of-contents + ul li a {
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
}

.chronicle-content #table-of-contents + ul li a:hover {
  color: #fff;
  text-decoration: underline;
}

/* The paragraph that follows the band should not hug it (generic p rule
   pulls up with a negative margin). */
.chronicle-content #table-of-contents + ul + p {
  margin-top: 0;
}

/* Chronicle post hero: same treatment as the auction/secondary heroes
   (PR #53) - the image slides up behind the header bar but the visible
   height and content position stay exactly as before. The 104px pulled
   behind the bar is added back as extra top padding. */
.chronicle-hero.chronicle-post-template {
  z-index: 5;
  /* Pull the breadcrumbs down to the headline: the 2rem content padding and
     half the breadcrumb margin move onto the hero itself (4rem + 2.5rem), so
     the hero keeps exactly the same height while the gap shrinks to 0.5rem. */
  padding-top: 6.5rem;
}
.chronicle-post-template .breadcrumbs-container {
  margin-bottom: 0.5rem;
}
.chronicle-post-template .chronicle-hero-content {
  padding-top: 0;
}

/* Hero image is a real <img> behind the content (it was a CSS background):
   same cover crop and the same 50% black wash as the old linear-gradient. */
.chronicle-hero.has-hero-image {
  overflow: hidden;
}

.chronicle-hero .chronicle-hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
}

.chronicle-hero.has-hero-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.chronicle-hero.has-hero-image > .container {
  position: relative;
  z-index: 2;
}

@media (min-width: 769px) {
  .chronicle-hero.chronicle-post-template {
    margin-top: -104px;
    padding-top: calc(6.5rem + 104px); /* 6.5rem: see the spacing note above */
  }
}

/* Hub intro: the Chronicle's own copy, under the hero. Runs the full width
   of the container like the sections below it; never a narrow left-aligned
   block. */
.chronicle-intro-section {
  padding: 2.5rem 0;
}
.chronicle-intro {
  width: 100%;
  max-width: none;
  font-size: 1.25rem;
  line-height: 1.65;
  margin: 0;
}
@media (max-width: 768px) {
  .chronicle-intro {
    font-size: 1.1rem;
  }
}
.chronicle-page-note {
  margin: 0;
  color: var(--color-text-muted, #555);
}

/* Hub hero crop. On desktop the hero slides 104px up behind the translucent
   header (styles.css), which hides the top of the picture. Nudging the
   image down 40px shows more of the top; phones keep the centred crop. */
.chronicle-hub-hero {
  height: 30vh;
  min-height: 450px;
  /* A light wash (25% black) over the photograph, enough to carry the white
     text without flattening the picture. The wash is its own layer, listed
     first, and is positioned separately from the photo below. */
  background-image: linear-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.25)), url('/assets/images/classic-chronicle-hero.avif');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
}
.chronicle-hub-hero .hero-overlay {
  display: none;
}
@media (min-width: 769px) {
  .chronicle-hub-hero {
    /* Per layer: the wash stays put and covers the box; only the photo is
       nudged down 40px. A single shared value would slide the wash too and
       leave a light band at the top. */
    background-position: center, center calc(50% + 40px);
  }
}
