/* ============================================================
   QRATI BLOG – blocks.css
   Gutenberg block styles aligned with the Qrati brand system.
   Applied in both the frontend and the block editor.
   ============================================================ */

/* ── Entry content wrapper ───────────────────────────────── */
.qb-entry-content,
.entry-content {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 17px;
  line-height: 1.75;
  color: var(--foreground);
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ── Headings ────────────────────────────────────────────── */
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6,
.wp-block-heading {
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--foreground);
  margin-top: 2em;
  margin-bottom: 0.6em;
  scroll-margin-top: calc(var(--navbar-h) + 20px);
}

.entry-content h1,
.wp-block-heading.has-h-1-font-size {
  font-size: clamp(28px, 5vw, 40px);
}
.entry-content h2,
.wp-block-heading.has-h-2-font-size {
  font-size: clamp(22px, 4vw, 30px);
}
.entry-content h3,
.wp-block-heading.has-h-3-font-size {
  font-size: clamp(18px, 3vw, 22px);
}
.entry-content h4 {
  font-size: 18px;
}
.entry-content h5 {
  font-size: 16px;
}
.entry-content h6 {
  font-size: 14px;
  color: var(--muted-foreground);
}

/* ── Paragraph ───────────────────────────────────────────── */
.entry-content p,
.wp-block-paragraph {
  color: var(--foreground);
}

.entry-content p.has-large-font-size {
  font-size: 20px;
}
.entry-content p.has-x-large-font-size {
  font-size: 24px;
  font-weight: 600;
}
.entry-content p.has-small-font-size {
  font-size: 14px;
  color: var(--muted-foreground);
}

/* Lead paragraph */
.entry-content > p:first-of-type {
  font-size: 18px;
  line-height: 1.65;
  color: var(--muted-foreground);
}

/* ── Links ───────────────────────────────────────────────── */
.entry-content a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.15s;
}
.entry-content a:hover {
  opacity: 0.8;
}

/* ── Lists ───────────────────────────────────────────────── */
.entry-content ul,
.entry-content ol,
.wp-block-list {
  padding-left: 1.5em;
  margin-bottom: 1.4em;
}
.entry-content ul {
  list-style-type: disc;
}
.entry-content ol {
  list-style-type: decimal;
}
.entry-content li {
  margin-bottom: 0.4em;
  line-height: 1.7;
}
.entry-content li > ul,
.entry-content li > ol {
  margin-top: 0.4em;
  margin-bottom: 0;
}

/* ── Blockquote ──────────────────────────────────────────── */
.entry-content blockquote,
.wp-block-quote {
  border-left: 4px solid var(--primary);
  margin: 2em 0;
  padding: 16px 20px;
  background-color: var(--muted);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.entry-content blockquote p,
.wp-block-quote p {
  font-size: 18px;
  font-style: italic;
  color: var(--foreground);
  margin-bottom: 0;
}
.wp-block-quote cite,
.entry-content blockquote cite {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  font-style: normal;
  color: var(--muted-foreground);
}

/* Pullquote */
.wp-block-pullquote {
  border-top: 4px solid var(--primary);
  border-bottom: 4px solid var(--primary);
  padding: 28px 24px;
  margin: 2em 0;
  text-align: center;
}
.wp-block-pullquote blockquote p {
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 700;
  font-style: italic;
  color: var(--foreground);
}
.wp-block-pullquote cite {
  font-size: 13px;
  color: var(--muted-foreground);
}

/* ── Code ────────────────────────────────────────────────── */
.entry-content code,
.wp-block-code code {
  font-family: "JetBrains Mono", "Fira Code", "Courier New", monospace;
  font-size: 0.875em;
  background-color: var(--muted);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.entry-content pre,
.wp-block-code,
.wp-block-preformatted {
  background-color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  overflow-x: auto;
  margin-bottom: 1.4em;
  font-size: 14px;
  line-height: 1.7;
}
.entry-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--foreground);
  font-size: inherit;
}

/* ── Image ───────────────────────────────────────────────── */
.entry-content img,
.wp-block-image img {
  border-radius: var(--radius);
  max-width: 100%;
  height: auto;
}
.wp-block-image figcaption,
.entry-content figcaption {
  font-size: 13px;
  color: var(--muted-foreground);
  text-align: center;
  margin-top: 8px;
  font-style: italic;
}
.wp-block-image.alignwide {
  margin-left: -40px;
  margin-right: -40px;
}
.wp-block-image.alignfull {
  margin-left: calc(-1 * var(--content-gutter, 24px));
  margin-right: calc(-1 * var(--content-gutter, 24px));
  border-radius: 0;
}

/* ── Separator ───────────────────────────────────────────── */
.wp-block-separator,
.entry-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
}
.wp-block-separator.is-style-dots {
  border: none;
  text-align: center;
  color: var(--muted-foreground);
}
.wp-block-separator.is-style-dots::before {
  content: "···";
  font-size: 24px;
  letter-spacing: 0.5em;
}
.wp-block-separator.is-style-wide {
  border-top-width: 2px;
  border-color: var(--primary);
}

/* ── Table ───────────────────────────────────────────────── */
.entry-content table,
.wp-block-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 1.4em;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.entry-content th,
.wp-block-table th {
  background-color: var(--muted);
  font-weight: 700;
  color: var(--foreground);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border);
}
.entry-content td,
.wp-block-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--foreground);
}
.wp-block-table tr:last-child td {
  border-bottom: none;
}
.wp-block-table.is-style-stripes tr:nth-child(odd) td {
  background-color: var(--muted);
}

/* ── Columns ─────────────────────────────────────────────── */
.wp-block-columns {
  display: flex;
  gap: 24px;
  margin-bottom: 1.4em;
  flex-wrap: wrap;
}
.wp-block-column {
  flex: 1 1 200px;
  min-width: 0;
}

.qb-feature-grid {
  margin: 2em 0;
}

.qb-feature-card {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background-color: var(--background);
  padding: 20px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.qb-feature-card .wp-block-heading,
.qb-feature-card h3 {
  margin-top: 0;
  margin-bottom: 0.6em;
  font-size: clamp(18px, 3vw, 20px);
}

.qb-feature-card p {
  margin-bottom: 0;
  color: var(--muted-foreground);
}

.qb-editorial-callout {
  margin: 2em 0;
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
  border-radius: var(--radius);
  background-color: color-mix(in srgb, var(--primary) 6%, var(--background));
  padding: 24px;
}

.qb-editorial-callout .wp-block-heading,
.qb-editorial-callout h3 {
  margin-top: 0;
  margin-bottom: 0.5em;
  font-size: clamp(20px, 3vw, 24px);
}

.qb-editorial-callout p {
  margin-bottom: 0;
  color: var(--muted-foreground);
}

.qb-highlight-card {
  margin: 2em 0;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--border));
  border-radius: calc(var(--radius) + 2px);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 6%, var(--background)) 0%, var(--background) 100%);
  padding: 24px;
}

.qb-highlight-card .wp-block-heading,
.qb-highlight-card h3 {
  margin-top: 0;
  margin-bottom: 0.5em;
}

.qb-highlight-card p:last-child,
.qb-highlight-card .wp-block-list:last-child,
.qb-highlight-card ul:last-child,
.qb-highlight-card ol:last-child {
  margin-bottom: 0;
}

.qb-results-card {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 10%, var(--background)) 0%, color-mix(in srgb, var(--primary) 4%, var(--background)) 100%);
}

.qb-stat-grid {
  margin: 2em 0;
  gap: 16px;
}

.qb-stat-card {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--background);
  padding: 24px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.qb-stat-card .wp-block-heading,
.qb-stat-card h3 {
  margin: 0;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1;
  color: var(--primary);
}

.qb-stat-card p {
  margin-top: 0.75em;
  margin-bottom: 0;
  color: var(--muted-foreground);
}

.qb-phase-grid {
  margin: 2em 0;
  gap: 18px;
}

.qb-phase-step {
  border: 1px solid color-mix(in srgb, var(--primary) 16%, var(--border));
  border-radius: calc(var(--radius) + 4px);
  background: color-mix(in srgb, var(--primary) 4%, var(--background));
  padding: 22px;
}

.qb-phase-step .wp-block-heading,
.qb-phase-step h3 {
  margin-top: 0;
  margin-bottom: 0.65em;
}

.qb-phase-step .wp-block-image {
  margin-top: 1.25em;
}

/* ── Cover ───────────────────────────────────────────────── */
.wp-block-cover {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.4em;
}
.wp-block-cover .wp-block-cover__inner-container {
  padding: 40px 24px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.wp-block-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 1.4em;
}
.wp-block-button__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition:
    opacity 0.15s,
    transform 0.15s;
  background-color: var(--primary);
  color: var(--primary-fg);
  cursor: pointer;
  border: none;
}
.wp-block-button__link:hover {
  opacity: 0.85;
}
.wp-block-button__link:active {
  transform: scale(0.97);
}

.wp-block-button.is-style-outline .wp-block-button__link {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.wp-block-button.is-style-outline .wp-block-button__link:hover {
  background-color: var(--primary);
  color: var(--primary-fg);
  opacity: 1;
}

/* ── Sidebar widgets ─────────────────────────────────────── */
.qb-blog-aside .widget,
.qb-blog-aside .wp-block-search,
.qb-blog-aside .wp-block-latest-posts,
.qb-blog-aside .wp-block-latest-comments,
.qb-blog-aside .wp-block-group {
  border: 1px solid var(--border);
  background: var(--background);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.qb-blog-aside .wp-block-search__inside-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.qb-blog-aside .wp-block-search__input {
  flex: 1 1 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--foreground);
  padding: 0.85rem 1rem;
  outline: none;
}

.qb-blog-aside .wp-block-search__input:focus {
  border-color: var(--primary);
}

.qb-blog-aside .wp-block-search__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  cursor: pointer;
  transition:
    opacity 0.15s,
    transform 0.15s;
}

.qb-blog-aside .wp-block-search__button:hover {
  opacity: 0.92;
}

.qb-blog-aside .wp-block-latest-posts__list,
.qb-blog-aside .wp-block-latest-comments {
  list-style: none;
  padding: 0;
  margin: 0;
}

.qb-blog-aside .wp-block-latest-posts__list li,
.qb-blog-aside .wp-block-latest-comments__comment {
  margin-bottom: 0.9rem;
}

.qb-blog-aside .wp-block-latest-posts__post-title,
.qb-blog-aside .wp-block-latest-comments__comment-author,
.qb-blog-aside .wp-block-latest-comments__comment-link {
  color: var(--foreground);
  text-decoration: none;
  transition: color 0.15s;
}

.qb-blog-aside .wp-block-latest-posts__post-title:hover,
.qb-blog-aside .wp-block-latest-comments__comment-author:hover,
.qb-blog-aside .wp-block-latest-comments__comment-link:hover {
  color: var(--primary);
}

/* ── Embed ───────────────────────────────────────────────── */
.wp-block-embed,
.entry-content .wp-block-embed {
  margin-bottom: 1.4em;
}
.wp-block-embed__wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius);
}
.wp-block-embed__wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ── Gallery ─────────────────────────────────────────────── */
.wp-block-gallery {
  display: grid;
  gap: 8px;
  margin-bottom: 1.4em;
}
.wp-block-gallery .blocks-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
}
.wp-block-gallery.columns-2 {
  grid-template-columns: repeat(2, 1fr);
}
.wp-block-gallery.columns-3 {
  grid-template-columns: repeat(3, 1fr);
}
.wp-block-gallery.columns-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* ── Details / Summary ───────────────────────────────────── */
.wp-block-details,
.entry-content details {
  background-color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 1em;
}
.entry-content summary {
  font-weight: 600;
  cursor: pointer;
  color: var(--foreground);
}

/* ── Notice/callout pattern (has-primary-background-color) ── */
.entry-content .has-primary-background-color {
  background-color: var(--primary) !important;
  color: var(--primary-fg) !important;
  padding: 16px 20px;
  border-radius: var(--radius);
}

/* ── Brand colour helpers ─────────────────────────────────── */
.has-primary-color {
  color: var(--primary) !important;
}
.has-foreground-color {
  color: var(--foreground) !important;
}
.has-background-color {
  color: var(--background) !important;
}
.has-muted-color {
  color: var(--muted-foreground) !important;
}
.has-primary-background-color {
  background-color: var(--primary) !important;
}
.has-foreground-background-color {
  background-color: var(--foreground) !important;
}
.has-muted-background-color {
  background-color: var(--muted) !important;
}

/* ── qrati/alert ─────────────────────────────────────────── */
/* layout (rounded-xl p-6 my-8) → Tailwind in render.php     */
.wp-block-qrati-alert.variant-muted {
  background: rgba(var(--muted-rgb), .5);
}
.wp-block-qrati-alert.variant-primary {
  background: rgba(var(--primary-rgb), .08);
  border: 1px solid rgba(var(--primary-rgb), .2);
}
.wp-block-qrati-alert.variant-warning {
  background: color-mix(in srgb, var(--warning) 8%, var(--background));
  border: 1px solid color-mix(in srgb, var(--warning) 25%, var(--border));
}
.wp-block-qrati-alert.variant-info {
  background: color-mix(in srgb, var(--info) 8%, var(--background));
  border: 1px solid color-mix(in srgb, var(--info) 25%, var(--border));
}
/* icon colour per variant — cannot use Tailwind (no data-attr selector) */
.wp-block-qrati-alert .qb-alert-header iconify-icon { color: var(--primary); }
.wp-block-qrati-alert.variant-warning .qb-alert-header iconify-icon { color: var(--warning); }
.wp-block-qrati-alert.variant-info    .qb-alert-header iconify-icon { color: var(--info); }
/* list indent inside alert description */
.wp-block-qrati-alert p ul,
.wp-block-qrati-alert p ol {
  padding-left: 1.25rem;
  margin: .5rem 0 0;
}

/* ── qrati/feature-cards ─────────────────────────────────── */
/* cards + inner → Tailwind in render.php; keep grid CSS var  */
.wp-block-qrati-feature-cards {
  display: grid;
  gap: 1rem;
  margin: 1.5rem 0;
  grid-template-columns: repeat(var(--fc-cols, 2), 1fr);
}
@media (max-width: 640px) {
  .wp-block-qrati-feature-cards { grid-template-columns: 1fr; }
}

/* ── qrati/steps ─────────────────────────────────────────── */
/* fully migrated to Tailwind in render.php                   */

/* ── qrati/stat-cards ────────────────────────────────────── */
/* outer layout → Tailwind in render.php; keep shadow + grid  */
.wp-block-qrati-stat-cards {
  box-shadow: 0 1px 3px rgba(15,23,42,.06);
}
.wp-block-qrati-stat-cards .qb-sc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border); /* 1px divider trick */
}
/* icon bg — rgba(var()) not expressible in Tailwind */
.wp-block-qrati-stat-cards .qb-sc-icon-wrap {
  background: rgba(var(--primary-rgb), .1);
}

/* ── qrati/comparison-table ──────────────────────────────── */
/* layout → Tailwind in render.php; keep header bg rgba()     */
.wp-block-qrati-comparison-table .qb-ct-header-left {
  background: rgba(var(--muted-rgb), .3);
}
.wp-block-qrati-comparison-table .qb-ct-header-right {
  background: rgba(var(--primary-rgb), .05);
}

/* ── qb-post-cta ─────────────────────────────────────────── */
.qb-post-cta {
  background: linear-gradient(135deg, rgba(var(--primary-rgb), .10), rgba(var(--primary-rgb), .05));
}

/* ── qb-connect-promo ────────────────────────────────────── */
.qb-connect-promo {
  background: linear-gradient(135deg, rgba(var(--primary-rgb), .20), rgba(var(--primary-rgb), .10));
}

/* ── Responsive tweaks for blocks ────────────────────────── */
@media (max-width: 639px) {
  .wp-block-columns {
    flex-direction: column;
    gap: 16px;
  }
  .wp-block-image.alignwide {
    margin-left: 0;
    margin-right: 0;
  }
  .wp-block-gallery.columns-3,
  .wp-block-gallery.columns-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}
