/* Blog-specific presentation. Scoped to /blog/* via app/(site)/blog/layout.tsx.
   Reuses the design tokens already defined in styles.css (colors, radii,
   shadows, font) instead of introducing a second design language. */

.blog-index,
.article {
  max-width: 74rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
  color: var(--color-dark);
  font-family: var(--font-family);
}

.blog-index {
  /* Matches the site header's own .container width/padding exactly (NOT
     .article's narrower 74rem column) so the whole /blog overview page —
     hero, card grid, everything — lines up with the header/menu above it. */
  max-width: var(--container-max);
  padding-inline: var(--container-padding);
  padding-top: 8rem;
  position: relative;
}

/* Full-bleed animated background behind the hero, bleeding down into the
   card grid's top row — breaks out of .blog-index's own max-width via the
   classic 100vw + negative-margin technique, independent of the parent's
   width/padding. z-index:-1 keeps it behind the hero text and the (opaque)
   article cards, matching how .hero__bg sits behind the homepage hero. */
.blog-index__bg {
  position: absolute;
  top: 0;
  left: 50%;
  width: 100vw;
  margin-left: -50vw;
  height: 46rem;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

/* === Shared small bits === */

.blog-sidebar__label {
  font-size: 0.8125rem;
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.04em;
  color: var(--color-soft);
  margin: 0 0 0.75rem;
}

/* === /blog hero === */

.blog-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 20rem;
  padding: 3rem 1.5rem;
  margin-bottom: 8rem;
}

.blog-hero__text {
  max-width: 40rem;
  margin: 0 auto;
}

.blog-hero__eyebrow {
  font-size: 0.875rem;
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  letter-spacing: 0.04em;
  text-align: center;
  /* The global `p { max-width: 60ch }` rule (styles.css) shrinks this <p>'s
     own box below .blog-hero__text's width — without margin:auto that box
     stays flush-left, so the (correctly centered) text inside it visually
     reads as off-center. margin:auto centers the shrunken box itself,
     matching .blog-hero__subtext's own max-width + margin:auto pairing. */
  max-width: fit-content;
  margin: 0 auto 0.5rem;
}

.blog-hero__text h1 {
  font-size: 2.25rem;
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  margin: 0 0 1rem;
}

.blog-hero__subtext {
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--color-dark);
  opacity: 0.75;
  margin: 0 auto;
  max-width: 34rem;
}

.blog-hero__illustration {
  flex: 0 0 auto;
  width: min(32rem, 46vw);
  position: relative;
}

/* Two-column variant used by /insights when a featured (newest) article
   exists: text stays left-aligned instead of the plain hero's centered
   layout, and a large featured card takes the other ~50% of the row. */
.blog-hero--featured {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 3rem;
  text-align: left;
}

.blog-hero--featured .blog-hero__text {
  margin: 0;
  max-width: none;
}

.blog-hero--featured .blog-hero__eyebrow,
.blog-hero--featured .blog-hero__subtext {
  text-align: left;
  margin-left: 0;
  margin-right: 0;
  max-width: none;
}

.blog-hero__featured {
  min-width: 0;
}

.blog-hero__featured-badge {
  font-size: 0.8125rem;
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  letter-spacing: 0.04em;
  margin: 0 0 0.75rem;
}

[data-theme="dark"] .blog-hero__featured-badge {
  color: var(--color-soft);
}

.blog-featured-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(var(--color-dark-rgb), 0.1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-white);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

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

.blog-featured-card__image-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.blog-featured-card__image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: var(--photo-grade);
}

.blog-featured-card__body {
  padding: 1.5rem 1.75rem 1.75rem;
}

.blog-featured-card__title {
  font-size: 1.5rem;
  font-weight: var(--font-weight-semibold);
  line-height: 1.3;
  margin: 0 0 0.625rem;
}

.blog-featured-card__description {
  margin: 0 0 1.25rem;
  font-size: 1rem;
  color: var(--color-dark);
  opacity: 0.75;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-featured-card__cta {
  font-size: 0.9375rem;
  font-weight: var(--font-weight-medium);
  color: var(--color-primary);
}

[data-theme="dark"] .blog-featured-card {
  background: rgba(30, 30, 50, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .blog-featured-card__cta {
  color: var(--color-soft);
}

/* === Load more === */

.blog-index__load-more {
  display: flex;
  justify-content: center;
  margin-top: 2.5rem;
}

.blog-hero__image {
  display: block;
  width: 100%;
  height: auto;
}

.blog-hero__image--dark {
  display: none;
}

[data-theme="dark"] .blog-hero__image--light {
  display: none;
}

[data-theme="dark"] .blog-hero__image--dark {
  display: block;
}

/* === Search + category controls === */

.blog-index__empty {
  color: var(--color-soft);
}

/* === Card grid === */

.blog-index__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}

.blog-card {
  border: 1px solid rgba(var(--color-dark-rgb), 0.1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-white);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

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

.blog-card__link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.blog-card__image-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.blog-card__image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: var(--photo-grade);
}

.blog-card__body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.blog-card__title {
  font-size: 1.125rem;
  font-weight: var(--font-weight-semibold);
  line-height: 1.35;
  margin: 0 0 0.5rem;
}

.blog-card__description {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  color: var(--color-dark);
  opacity: 0.75;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card__cta {
  font-size: 0.875rem;
  font-weight: var(--font-weight-medium);
  color: var(--color-primary);
}

/* === Article: breadcrumb === */

.article__breadcrumb {
  font-size: 0.8125rem;
  color: var(--color-soft);
  margin-bottom: 1.5rem;
}

.article__breadcrumb a {
  color: var(--color-soft);
  text-decoration: none;
}

.article__breadcrumb a:hover {
  text-decoration: underline;
}

.article__breadcrumb-current {
  color: var(--color-dark);
  opacity: 0.6;
}

/* === Article: hero (always dark, independent of the site-wide theme toggle) === */

.article__hero {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  background: linear-gradient(135deg, var(--color-dark-dark, #12002e), #0d0d1a);
  color: #ffffff;
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  margin-bottom: 2.5rem;
}

.article__hero-text {
  min-width: 0;
}

.article__title {
  font-size: 2rem;
  font-weight: var(--font-weight-bold);
  line-height: 1.25;
  margin: 0 0 1rem;
  color: #ffffff;
}

.article__meta {
  font-size: 0.9375rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

.article__meta-author {
  color: #ffffff;
  font-weight: var(--font-weight-medium);
}

.article__hero-image {
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.article__hero-image-svg {
  display: block;
  width: 100%;
  height: auto;
}

.article__hero-image-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  filter: var(--photo-grade);
}

/* === Article: two-column body + sidebar === */

.article__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16rem;
  gap: 3rem;
  align-items: start;
}

.article__body {
  min-width: 0;
  line-height: 1.75;
  font-size: 1.0625rem;
}

.article__sidebar-sticky {
  position: sticky;
  top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.article__toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  border-left: 2px solid rgba(var(--color-dark-rgb), 0.1);
}

.article__toc a {
  display: block;
  padding: 0.125rem 0 0.125rem 0.9rem;
  margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--color-dark);
  opacity: 0.75;
  text-decoration: none;
  font-size: 0.9375rem;
}

.article__toc a:hover {
  opacity: 1;
  border-left-color: var(--color-primary);
  color: var(--color-primary);
}

.blog-sidebar__share-links {
  display: flex;
  gap: 0.625rem;
}

.blog-sidebar__share-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-full);
  background: var(--color-soft-light);
  color: var(--color-primary);
}

.blog-sidebar__share-link svg {
  width: 1.1rem;
  height: 1.1rem;
}

.blog-sidebar__share-link:hover {
  background: var(--color-primary);
  color: #ffffff;
}

.article__body h2 {
  font-size: 1.5rem;
  font-weight: var(--font-weight-semibold);
  margin: 2.5rem 0 1rem;
  scroll-margin-top: 2rem;
}

.article__body p {
  margin: 0 0 1.25rem;
}

/* Inline links inside the article body (e.g. cross-links to other articles
   in the Fazit paragraph) otherwise inherit the global `a { color: inherit;
   text-decoration: none }` reset and become visually indistinguishable from
   surrounding text, even though they are real links. */
.article__body a {
  color: var(--color-primary);
  text-decoration: underline;
}

.article__body a:hover {
  color: var(--color-primary-light);
}

.article__body blockquote {
  margin: 0 0 1.25rem;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--color-primary);
  background: var(--color-soft-light);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.article__body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5rem;
  font-size: 0.9375rem;
}

.article__body th,
.article__body td {
  text-align: left;
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid rgba(var(--color-dark-rgb), 0.1);
}

.article__body th {
  font-weight: var(--font-weight-semibold);
}

.article__body code {
  background: var(--color-soft-light);
  border-radius: var(--radius-sm);
  padding: 0.125rem 0.375rem;
  font-size: 0.9em;
}

/* === CTA box === */

.blog-cta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 1.75rem 2rem;
  margin: 3rem 0 2.5rem;
  border-radius: var(--radius-xl);
  background: var(--color-soft-light);
}

.blog-cta__icon {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  color: var(--color-primary);
}

.blog-cta__text {
  flex: 1 1 16rem;
}

.blog-cta__title {
  font-weight: var(--font-weight-semibold);
  margin: 0 0 0.25rem;
}

.blog-cta__subtext {
  margin: 0;
  opacity: 0.8;
  font-size: 0.9375rem;
}

.blog-cta__button {
  flex: 0 0 auto;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #ffffff;
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  white-space: nowrap;
}

.blog-cta__button:hover {
  background: var(--color-primary-light);
}

/* === Prev/next navigation === */

.blog-article__nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.blog-article__nav-link {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.25rem;
  border: 1px solid rgba(var(--color-dark-rgb), 0.1);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
}

.blog-article__nav-link:hover {
  border-color: var(--color-primary);
}

.blog-article__nav-link--next {
  text-align: right;
  grid-column: 2;
}

.blog-article__nav-label {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--color-soft);
}

.blog-article__nav-title {
  font-weight: var(--font-weight-medium);
}

.blog-article__extra {
  max-width: 74rem;
  margin: 0 auto;
  padding: 0 1.5rem 6rem;
}

.blog-article__back a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
}

/* === Dark mode overrides === */

[data-theme="dark"] .blog-card,
[data-theme="dark"] .blog-article__nav-link {
  background: rgba(30, 30, 50, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .article__toc ul {
  border-left-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .article__toc a {
  color: #ffffff;
}

[data-theme="dark"] .blog-hero__eyebrow,
[data-theme="dark"] .blog-card__cta {
  color: var(--color-soft);
}

[data-theme="dark"] .article__body a {
  color: var(--color-soft);
}

[data-theme="dark"] .blog-cta {
  background: rgba(76, 17, 255, 0.15);
}

/* === Responsive === */

@media (max-width: 860px) {
  .blog-hero__illustration {
    width: 100%;
    max-width: 24rem;
  }

  .blog-hero--featured {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .blog-hero--featured .blog-hero__text {
    margin: 0 auto;
  }

  .blog-hero--featured .blog-hero__eyebrow,
  .blog-hero--featured .blog-hero__subtext {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
  }

  .article__layout {
    grid-template-columns: 1fr;
  }

  .article__sidebar-sticky {
    position: static;
  }

  .blog-article__nav {
    grid-template-columns: 1fr;
  }

  .blog-article__nav-link--next {
    grid-column: 1;
    text-align: left;
  }

  .blog-index__list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .blog-index__list {
    grid-template-columns: 1fr;
  }
}
