/* ---------------------------------------------------------
   Modern Blog / Article UX Refresh
   Drop-in replacement for the existing styles
--------------------------------------------------------- */

/* Small token layer (safe defaults, uses your theme vars where possible) */
:root {
  --blog-gap-x: clamp(16px, 2vw, 32px);
  --blog-gap-y: clamp(28px, 3vw, 64px);

  --surface: color-mix(in srgb, var(--body_background, #fff) 92%, #000 8%);
  --surface-2: var(--body_alternate_background, #f6f6f6);
  --border: color-mix(in srgb, var(--border_color, #dcdcdc) 70%, transparent);

  --radius: var(--card_radius, 16px);
  --radius-sm: calc(var(--radius) / 2);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.06), 0 6px 18px rgba(0,0,0,.06);
  --shadow-md: 0 2px 6px rgba(0,0,0,.08), 0 14px 30px rgba(0,0,0,.10);

  --ease: cubic-bezier(.2,.8,.2,1);
}

/* ---------- Blog listing grid ---------- */
.main-blog--items-wrapper {
  display: grid;
  gap: var(--blog-gap-y) var(--blog-gap-x);
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  align-items: stretch;
}

/* optional: nicer rhythm if cards have uneven heights */
.main-blog--items-wrapper > * {
  min-width: 0;
}

/* ---------- Article header ---------- */
.main-article--content-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;

  padding: clamp(16px, 2vw, 22px);
  margin-bottom: clamp(18px, 2vw, 28px);

  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* If your header contains links/buttons, make them feel premium */
.main-article--content-header a {
  text-decoration: none;
}
.main-article--content-header a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Rich text body typography ---------- */
.main-article--body,
.main-article--form-body {
  padding-top: clamp(28px, 4vw, 56px);
}

/* Better reading rhythm */
.main-article--body.rte {
  line-height: 1.7;
  letter-spacing: 0.01em;
}

.main-article--body.rte p,
.main-article--body.rte li {
  margin: 14px 0;
}

.main-article--body.rte h2,
.main-article--body.rte h3,
.main-article--body.rte h4 {
  margin-top: 28px;
  margin-bottom: 10px;
  line-height: 1.25;
}

/* Modern link styling inside article body */
.main-article--body.rte a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: opacity .2s var(--ease);
}
.main-article--body.rte a:hover {
  opacity: .85;
}

/* Images: polished + interactive */
.main-article--body.rte img {
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
  max-width: 100%;
  height: auto;
}
@media (hover: hover) {
  .main-article--body.rte img:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
}

/* ---------- Blockquote: modern card + accent ---------- */
.main-article--body.rte blockquote {
  position: relative;
  margin: clamp(22px, 3vw, 38px) 0;
  padding: clamp(18px, 2.4vw, 28px) clamp(18px, 2.4vw, 30px);
  padding-top: clamp(40px, 4vw, 56px);

  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(
      180deg,
      color-mix(in srgb, var(--surface-2) 86%, transparent) 0%,
      color-mix(in srgb, var(--surface) 92%, transparent) 100%
  );
  box-shadow: var(--shadow-sm);

  text-align: left;
}

.main-article--body.rte blockquote > *:last-child {
  margin-bottom: 0;
}

.main-article--body.rte blockquote:before {
  content: "";
  -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 54 54'%3E%3Cpath d='M41.625 47.25a12.375 12.375 0 1 0 0-24.75c-.357 0-.706.024-1.055.054a35.775 35.775 0 0 1 5.384-15.208A1.126 1.126 0 0 0 45 5.625h-2.25a1.125 1.125 0 0 0-.816.35c-5.785 6.086-12.684 16.04-12.684 28.9A12.39 12.39 0 0 0 41.625 47.25Zm-29.25 0a12.375 12.375 0 1 0 0-24.75c-.357 0-.707.024-1.055.054a35.775 35.775 0 0 1 5.384-15.208 1.126 1.126 0 0 0-.954-1.721H13.5a1.125 1.125 0 0 0-.816.35C6.9 12.06 0 22.015 0 34.875A12.39 12.39 0 0 0 12.375 47.25Z' fill='currentColor'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 54 54'%3E%3Cpath d='M41.625 47.25a12.375 12.375 0 1 0 0-24.75c-.357 0-.706.024-1.055.054a35.775 35.775 0 0 1 5.384-15.208A1.126 1.126 0 0 0 45 5.625h-2.25a1.125 1.125 0 0 0-.816.35c-5.785 6.086-12.684 16.04-12.684 28.9A12.39 12.39 0 0 0 41.625 47.25Zm-29.25 0a12.375 12.375 0 1 0 0-24.75c-.357 0-.707.024-1.055.054a35.775 35.775 0 0 1 5.384-15.208 1.126 1.126 0 0 0-.954-1.721H13.5a1.125 1.125 0 0 0-.816.35C6.9 12.06 0 22.015 0 34.875A12.39 12.39 0 0 0 12.375 47.25Z' fill='currentColor'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 36px 36px;
  mask-size: 36px 36px;

  position: absolute;
  inset-block-start: 16px;
  inset-inline-start: 18px;

  width: 36px;
  height: 36px;

  background: color-mix(in srgb, currentColor 70%, transparent);
}

/* Add a subtle accent bar */
.main-article--body.rte blockquote:after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-block: 0;
  width: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 55%, transparent);
  margin: 14px;
}

/* ---------- Comments: modern card UI ---------- */
.main-article--comment-item {
  padding: clamp(16px, 2.2vw, 28px);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.main-article--comment-item + .main-article--comment-item {
  margin-top: 16px;
}

.main-article--comment-content {
  padding-bottom: 10px;
}

.main-article--comment-content p {
  font-size: var(--text_medium);
  line-height: 1.7;
}

/* ---------- Form box: elevated + focus states ---------- */
.main-article--form-box {
  background: var(--surface-2);
  padding: clamp(18px, 3vw, 44px);
  border-radius: var(--radius);
  margin-top: clamp(24px, 4vw, 56px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.main-article--form-heading {
  padding-bottom: 14px;
}

.main-article--form-heading-small {
  opacity: 0.65;
  font-weight: 400;
}

/* Make inputs feel modern without knowing your exact markup */
.main-article--form-box input,
.main-article--form-box textarea,
.main-article--form-box select {
  border-radius: calc(var(--radius) / 1.6);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--body_background, #fff) 92%, transparent);
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease);
}

.main-article--form-box input:focus,
.main-article--form-box textarea:focus,
.main-article--form-box select:focus {
  outline: none;
  border-color: color-mix(in srgb, currentColor 35%, var(--border));
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 14%, transparent);
}

/* ---------- Related section spacing ---------- */
.main-article--related {
  padding-top: clamp(28px, 4vw, 56px);
}

/* ---------- Container width tweak ---------- */
@media (min-width: 1200px) {
  .main-article--content {
    max-width: 880px; /* more editorial + premium */
    margin: 0 auto;
  }
}

/* ---------- Responsive refinements ---------- */
@media (max-width: 991px) {
  .main-article--content-header {
    padding: 16px;
  }
}

@media (max-width: 767px) {
  .main-blog--items-wrapper {
    row-gap: 28px;
  }

  /* Mobile swipe polish */
  .main-blog--items-wrapper.mobile-swipe {
    grid-auto-flow: column;
    grid-auto-columns: minmax(78%, 1fr);
    grid-template-columns: repeat(auto-fill, minmax(78%, 1fr));
    overflow-x: auto;
    justify-content: flex-start;
    scroll-snap-type: x mandatory;
    padding-bottom: 14px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none; /* Firefox */
  }
  .main-blog--items-wrapper.mobile-swipe::-webkit-scrollbar {
    display: none; /* WebKit */
  }
  .main-blog--items-wrapper.mobile-swipe .blog--item {
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .main-article--body.rte img,
  .main-article--form-box input,
  .main-article--form-box textarea,
  .main-article--form-box select {
    transition: none !important;
  }
}
