/* ==========================================================================
   Single blog post (article page)
   Markup: resources/views/frontend/partials/blog-details.blade.php
   Script: public/frontend/assets/js/pages/blog-single.js
   Design: "Webase — Services Section Redesign" canvas, BlogSingle.dc.html
   Cards in "Keep reading": <x-post-card> (css/components/post-card.css)
   ========================================================================== */

.wb-article {
  --wb-article-bg: #F4F1EA;
  --wb-article-dark: #0E0720;
  --wb-article-navy: #202547;
  --wb-article-text: #3D4263;
  --wb-article-muted: #5B6080;
  --wb-article-soft: #C9CCE3;
  --wb-article-accent: #ED194E;
  --wb-article-eyebrow: #C8163F;
  --wb-article-ease: cubic-bezier(.2, .8, .2, 1);

  background: var(--wb-article-bg);
  color: var(--wb-article-navy);
  font-family: 'Inter', system-ui, sans-serif;
}

/* ---------- Reading progress (above the fixed header) ---------- */

.wb-article__progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1001;
  height: 4px;
  pointer-events: none;
}

.wb-article__progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--wb-article-accent);
  transition: width .15s linear;
}

/* ---------- Split hero ---------- */

.wb-article-hero {
  position: relative;
  overflow: hidden;
  /* the global header overlays the top */
  padding: calc(var(--wb-header-height, 108px) + 48px) 0 96px;
  background: var(--wb-article-dark);
  color: #FFFFFF;
  font-family: 'Inter Tight', system-ui, sans-serif;
}

.wb-article-hero__photo,
.wb-article-hero__shade,
.wb-article-hero__glow {
  position: absolute;
  pointer-events: none;
}

.wb-article-hero__photo {
  inset: 0;
  background: url('../../img/hero/hero-slide-2.webp') 70% center / cover no-repeat;
  filter: contrast(1.05);
}

.wb-article-hero__shade {
  inset: 0;
  background: linear-gradient(90deg, rgba(20, 8, 48, .97) 0%, rgba(28, 12, 66, .92) 50%, rgba(42, 18, 96, .75) 100%);
}

.wb-article-hero__glow {
  border-radius: 50%;
  filter: blur(160px);
}

.wb-article-hero__glow--red {
  right: -160px;
  top: -200px;
  width: 640px;
  height: 640px;
  background: var(--wb-article-accent);
  opacity: .16;
}

.wb-article-hero__glow--violet {
  left: -200px;
  bottom: -280px;
  width: 760px;
  height: 760px;
  background: #8B5CF6;
  opacity: .22;
}

.wb-article-hero__split {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 56px;
  align-items: center;
}

.wb-article-hero__copy {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.wb-article .wb-article-hero__back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: #FFFFFF;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .3s ease, gap .3s ease;
}

.wb-article .wb-article-hero__back:hover {
  gap: 12px;
  color: #FFFFFF;
  background: rgba(255, 255, 255, .16);
}

.wb-article-hero__title {
  margin: 0;
  font-family: inherit;
  font-size: clamp(34px, 4.2vw, 60px);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.04em;
  color: #FFFFFF;
}

.wb-article-hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, .14);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: #D5D0EA;
}

.wb-article-hero__author {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.wb-article-hero__author > span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.wb-article-hero__by {
  font-size: 12px;
  color: #B8B3D0;
}

.wb-article-hero__author strong {
  color: #FFFFFF;
}

.wb-article-hero__rule {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, .2);
}

.wb-article-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--wb-article-accent);
}

.wb-article-avatar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--wb-article-accent);
  color: #FFFFFF;
  font-family: 'Kanit', sans-serif;
  font-size: 18px;
  font-weight: 600;
}

.wb-article-avatar--lg {
  width: 64px;
  height: 64px;
  font-size: 26px;
}

.wb-article-hero__cover {
  margin: 0;
  aspect-ratio: 1024 / 561;
  overflow: hidden;
  border: 6px solid rgba(255, 255, 255, .12);
  border-radius: 28px;
  background: var(--wb-article-navy);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .7);
  transform: rotate(-1.5deg);
  transition: transform .6s var(--wb-article-ease);
}

.wb-article-hero__cover:hover {
  transform: rotate(0deg) scale(1.02);
}

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

/* ---------- Body grid ---------- */

.wb-article-body {
  position: relative;
  padding: 80px 0 48px;
}

.wb-article-glow {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.wb-article-glow span {
  position: absolute;
  display: block;
  border-radius: 50%;
}

.wb-article-glow__red {
  right: -100px;
  top: 15%;
  width: 460px;
  height: 420px;
  background: var(--wb-article-accent);
  opacity: .1;
  filter: blur(120px);
}

.wb-article-glow__blue {
  left: -140px;
  top: 55%;
  width: 520px;
  height: 460px;
  background: #3D5AFE;
  opacity: .1;
  filter: blur(130px);
}

.wb-article-body__grid {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 760px) 260px;
  justify-content: space-between;
  gap: 40px;
  align-items: start;
}

/* Sticky rails sit below the fixed header */
.wb-article-share,
.wb-article-toc {
  position: sticky;
  top: 110px;
}

/* ---------- Share rail ---------- */

.wb-article-share {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.wb-article-share__label {
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--wb-article-muted);
}

.wb-article .wb-article-share a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1.5px solid rgba(32, 37, 71, .15);
  border-radius: 50%;
  background: rgba(255, 255, 255, .7);
  color: var(--wb-article-navy);
  transition: background-color .35s ease, color .35s ease, border-color .35s ease, transform .35s var(--wb-article-ease);
}

.wb-article .wb-article-share a:hover,
.wb-article .wb-article-share a:focus-visible {
  border-color: var(--wb-article-accent);
  background: var(--wb-article-accent);
  color: #FFFFFF;
  transform: translateY(-3px);
}

/* ---------- On this page ---------- */

.wb-article-toc {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wb-article-toc[hidden] {
  display: none;
}

.wb-article-toc__title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--wb-article-eyebrow);
}

.wb-article-toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.wb-article .wb-article-toc__list a {
  display: block;
  padding: 9px 0 9px 16px;
  border-left: 2px solid rgba(32, 37, 71, .12);
  color: var(--wb-article-muted);
  font-size: 14px;
  line-height: 1.45;
  text-decoration: none;
  transition: color .35s ease, border-color .35s ease, padding-left .35s ease;
}

.wb-article .wb-article-toc__list a:hover,
.wb-article .wb-article-toc__list a.is-active {
  padding-left: 22px;
  border-left-color: var(--wb-article-accent);
  color: var(--wb-article-navy);
}

/* ---------- Article content (whatever the admin editor outputs) ---------- */

.wb-entry {
  min-width: 0;
  font-size: 18px;
  line-height: 1.85;
  color: var(--wb-article-text);
}

/* The editor wraps posts in Bootstrap containers — flatten them */
.wb-entry .container,
.wb-entry .container-fluid,
.wb-entry .row,
.wb-entry [class*="col-"] {
  display: block;   /* .row is flex in Bootstrap — as a flex item the column would grow to its text's full width */
  flex: none;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

/* The editor adds inline font sizes to most text — keep the article's own typography */
.wb-entry [style*="font-size"] {
  font-size: inherit !important;
  line-height: inherit !important;
}

.wb-entry p,
.wb-entry ul,
.wb-entry ol,
.wb-entry blockquote,
.wb-entry figure,
.wb-entry table {
  margin: 0 0 22px;
}

/* Lead paragraph with a drop cap */
.wb-entry p.is-lead {
  font-family: 'Urbanist', system-ui, sans-serif;
  font-size: 23px;
  line-height: 1.6;
  color: var(--wb-article-navy);
}

.wb-entry p.is-lead::first-letter {
  float: left;
  padding: 8px 12px 0 0;
  font-family: 'Kanit', sans-serif;
  font-size: 78px;
  font-weight: 700;
  line-height: .85;
  color: var(--wb-article-accent);
}

/* Section headings (posts use h2 — some also h1) */
.wb-entry h1,
.wb-entry h2 {
  position: relative;
  margin: 56px 0 18px;
  padding-top: 28px;
  font-family: 'Kanit', sans-serif;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--wb-article-navy);
  scroll-margin-top: 120px;
}

.wb-entry h1::before,
.wb-entry h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 56px;
  height: 4px;
  border-radius: 4px;
  background: var(--wb-article-accent);
}

.wb-entry h3,
.wb-entry h4 {
  margin: 36px 0 12px;
  font-family: 'Kanit', sans-serif;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--wb-article-navy);
  scroll-margin-top: 120px;
}

.wb-entry h4 {
  font-size: 20px;
}

.wb-entry > :first-child,
.wb-entry .col-12 > :first-child {
  margin-top: 0;
}

.wb-entry strong,
.wb-entry b {
  font-weight: 600;
  color: var(--wb-article-navy);
}

.wb-entry a {
  color: var(--wb-article-eyebrow);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Lists as glass panels with red check bullets */
.wb-entry ul,
.wb-entry ol {
  padding: 24px 28px;
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 22px;
  background: rgba(255, 255, 255, .62);
  box-shadow: 0 10px 26px -18px rgba(32, 37, 71, .25);
  list-style: none;
}

.wb-entry li {
  position: relative;
  margin: 0 0 12px;
  padding-left: 34px;
}

.wb-entry li:last-child {
  margin-bottom: 0;
}

.wb-entry li > p {
  margin: 0;
}

.wb-entry ul > li::before {
  content: '';
  position: absolute;
  left: 0;
  top: .45em;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--wb-article-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center / 12px no-repeat;
}

.wb-entry ol {
  counter-reset: wb-entry-ol;
}

.wb-entry ol > li {
  counter-increment: wb-entry-ol;
}

.wb-entry ol > li::before {
  content: counter(wb-entry-ol);
  position: absolute;
  left: 0;
  top: .3em;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--wb-article-navy);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

/* Nested lists: no second panel */
.wb-entry li ul,
.wb-entry li ol {
  margin: 12px 0 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.wb-entry blockquote {
  padding: 24px 28px;
  border: 0;
  border-radius: 22px;
  background: var(--wb-article-navy);
  color: #E6E8F4;
  font-family: 'Urbanist', system-ui, sans-serif;
  font-size: 21px;
  line-height: 1.6;
}

.wb-entry blockquote p:last-child {
  margin-bottom: 0;
}

.wb-entry hr {
  height: 1px;
  margin: 40px 0;
  border: 0;
  background: rgba(32, 37, 71, .12);
  opacity: 1;
}

.wb-entry img {
  max-width: 100%;
  height: auto;
  border-radius: 22px;
}

.wb-entry table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.wb-entry th,
.wb-entry td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(32, 37, 71, .12);
  text-align: left;
}

/* ---------- Author ---------- */

.wb-article-author-wrap {
  padding: 0 0 96px;
}

.wb-article-author {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 760px;
  margin: 0 auto;
  padding: 28px;
  border-radius: 26px;
  background: var(--wb-article-navy);
  color: #FFFFFF;
}

.wb-article-author__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
  color: var(--wb-article-soft);
}

.wb-article-author__text strong {
  font-family: 'Kanit', sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: #FFFFFF;
}

/* ---------- Keep reading ---------- */

.wb-article-more {
  padding: 96px 0 120px;
  background: #EDE9E0;
}

.wb-article-more__inner {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.wb-article-more__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
}

.wb-article-more__heading {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wb-article-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--wb-article-eyebrow);
}

.wb-article-eyebrow::before {
  content: '';
  display: block;
  width: 28px;
  height: 2px;
  background: var(--wb-article-accent);
}

.wb-article-more__title {
  margin: 0;
  font-family: 'Kanit', sans-serif;
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 700;
  line-height: 1.05;
  color: var(--wb-article-navy);
}

.wb-article .wb-article-more__all {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  box-sizing: border-box;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--wb-article-navy);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: transform .4s var(--wb-article-ease), background-color .4s ease;
}

.wb-article .wb-article-more__all:hover {
  color: #FFFFFF;
  background: var(--wb-article-accent);
  transform: translateY(-3px);
}

/* ---------- Responsive ---------- */

@media (max-width: 1199.98px) {
  .wb-article-body__grid {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .wb-article-toc,
  .wb-article-toc:not([hidden]) {
    display: none;
  }
}

@media (max-width: 991.98px) {
  .wb-article-hero__split {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }
}

@media (max-width: 767.98px) {
  .wb-article-hero {
    padding: calc(var(--wb-header-height, 92px) + 24px) 0 50px;
  }

  .wb-article-hero__cover {
    transform: none;
    border-width: 4px;
    border-radius: 20px;
  }

  .wb-article-body {
    padding: 40px 0 24px;
  }

  .wb-article-body__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  /* share rail becomes a row above the article */
  .wb-article-share {
    position: static;
    flex-direction: row;
    justify-content: flex-start;
  }

  .wb-article-share__label {
    margin: 0 6px 0 0;
  }

  .wb-entry {
    font-size: 17px;
  }

  .wb-entry p.is-lead {
    font-size: 19px;
  }

  .wb-entry p.is-lead::first-letter {
    font-size: 60px;
  }

  .wb-entry h1,
  .wb-entry h2 {
    margin-top: 40px;
    font-size: 26px;
  }

  .wb-entry h3 {
    font-size: 21px;
  }

  .wb-entry ul,
  .wb-entry ol {
    padding: 18px 18px;
  }

  .wb-article-author-wrap {
    padding-bottom: 50px;
  }

  .wb-article-more {
    padding: 50px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wb-article__progress span,
  .wb-article-hero__cover,
  .wb-article-share a,
  .wb-article-toc__list a,
  .wb-article-more__all {
    transition: none;
  }
}
