/*
 * Nicotinos shared typography / rich-text.
 *
 * Scope: product descriptions, static pages, articles, SEO blocks.
 * Out of scope: product cards (ul.products / .pc-*), checkout form controls
 * (.ck-step-content inputs, qty steppers), and .nic-lang-switcher* (Agent 3).
 *
 * Presentation only — no commerce or price rules.
 */

:root {
  --nic-prose-measure: 68ch;
  --nic-prose-size: 1.015625rem; /* ~16.25px */
  --nic-prose-size-sm: 0.96875rem;
  --nic-prose-lh: 1.75;
  --nic-prose-color: #374151;
  --nic-prose-muted: var(--color-text-light, #6b7280);
  --nic-prose-heading: var(--color-primary, #1b3a5c);
  --nic-prose-link: var(--color-primary, #1b3a5c);
  --nic-prose-link-hover: var(--color-primary-hover, #122840);
  --nic-prose-border: var(--color-border, #e5e7eb);
  --nic-prose-surface: var(--color-surface, #f9fafb);
  --nic-prose-space-block: 1.15em;
  --nic-prose-space-heading: 1.65em;
}

/* ── Shared rich-text scope ─────────────────────────────────────────────── */
.nic-prose,
.page-body,
.blog-single__content,
.homepage-seo-text,
.sp-short-desc,
.product-short-desc,
.woocommerce-product-details__short-description,
.woocommerce-Tabs-panel--description,
.woocommerce-Tabs-panel--additional_information,
.entry-content {
  color: var(--nic-prose-color);
  font-size: var(--nic-prose-size);
  line-height: var(--nic-prose-lh);
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}

.blog-single__content,
.page-inner,
.homepage-seo-text {
  max-width: min(100%, calc(var(--nic-prose-measure) + 4rem));
}

.blog-single__content {
  max-width: var(--nic-prose-measure);
}

/* Headings — hierarchy + rhythm (scoped; does not restyle card titles) */
.nic-prose h1,
.page-body h1,
.blog-single__content h1,
.woocommerce-Tabs-panel--description h1,
.entry-content h1 {
  font-size: clamp(1.75rem, 3.2vw, 2.25rem);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.02em;
  color: var(--nic-prose-heading);
  margin: 0 0 1.15em;
  padding-bottom: 0.55em;
  border-bottom: 2px solid #dce9f5;
}

.nic-prose h2,
.page-body h2,
.blog-single__content h2,
.homepage-seo-text h2,
.woocommerce-Tabs-panel--description h2,
.entry-content h2 {
  font-size: clamp(1.2rem, 2.2vw, 1.45rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--nic-prose-heading);
  margin: var(--nic-prose-space-heading) 0 0.55em;
  padding-bottom: 0.35em;
  border-bottom: 1px solid #e8f0ef;
}

.nic-prose h3,
.page-body h3,
.blog-single__content h3,
.woocommerce-Tabs-panel--description h3,
.entry-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--nic-prose-heading);
  margin: 1.35em 0 0.4em;
  border-bottom: none;
  padding-bottom: 0;
}

.nic-prose h4,
.page-body h4,
.blog-single__content h4,
.entry-content h4 {
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--nic-prose-heading);
  margin: 1.2em 0 0.35em;
}

.nic-prose p,
.page-body p,
.blog-single__content p,
.homepage-seo-text p,
.woocommerce-Tabs-panel--description p,
.entry-content p,
.sp-short-desc p,
.product-short-desc p,
.woocommerce-product-details__short-description p {
  margin: 0 0 var(--nic-prose-space-block);
  max-width: var(--nic-prose-measure);
}

.nic-prose p:last-child,
.page-body p:last-child,
.blog-single__content p:last-child,
.homepage-seo-text p:last-child,
.woocommerce-Tabs-panel--description p:last-child,
.sp-short-desc p:last-child {
  margin-bottom: 0;
}

/* Lists — restore markers only inside rich text (global reset clears them) */
.nic-prose ul,
.page-body ul,
.blog-single__content ul,
.woocommerce-Tabs-panel--description ul,
.entry-content ul {
  list-style: disc;
  margin: 0 0 var(--nic-prose-space-block);
  padding-left: 1.35em;
  max-width: var(--nic-prose-measure);
}

.nic-prose ol,
.page-body ol,
.blog-single__content ol,
.woocommerce-Tabs-panel--description ol,
.entry-content ol {
  list-style: decimal;
  margin: 0 0 var(--nic-prose-space-block);
  padding-left: 1.35em;
  max-width: var(--nic-prose-measure);
}

.nic-prose li,
.page-body li,
.blog-single__content li,
.woocommerce-Tabs-panel--description li,
.entry-content li {
  margin: 0 0 0.4em;
  padding-left: 0.15em;
  line-height: var(--nic-prose-lh);
}

.nic-prose li > ul,
.nic-prose li > ol,
.page-body li > ul,
.page-body li > ol,
.blog-single__content li > ul,
.blog-single__content li > ol,
.woocommerce-Tabs-panel--description li > ul,
.woocommerce-Tabs-panel--description li > ol,
.entry-content li > ul,
.entry-content li > ol {
  margin-top: 0.35em;
  margin-bottom: 0.35em;
}

/* Links */
.nic-prose a,
.page-body a,
.blog-single__content a,
.homepage-seo-text a,
.woocommerce-Tabs-panel--description a,
.entry-content a,
.sp-short-desc a,
.product-short-desc a,
.woocommerce-product-details__short-description a {
  color: var(--nic-prose-link);
  text-decoration: underline;
  text-underline-offset: 0.16em;
  text-decoration-thickness: from-font;
}

.nic-prose a:hover,
.page-body a:hover,
.blog-single__content a:hover,
.homepage-seo-text a:hover,
.woocommerce-Tabs-panel--description a:hover,
.entry-content a:hover,
.sp-short-desc a:hover {
  color: var(--nic-prose-link-hover);
}

.nic-prose a:focus-visible,
.page-body a:focus-visible,
.blog-single__content a:focus-visible,
.homepage-seo-text a:focus-visible,
.woocommerce-Tabs-panel--description a:focus-visible,
.entry-content a:focus-visible {
  outline: 2px solid var(--nic-prose-link);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Emphasis */
.nic-prose strong,
.page-body strong,
.blog-single__content strong,
.woocommerce-Tabs-panel--description strong,
.entry-content strong {
  color: var(--nic-prose-heading);
  font-weight: 600;
}

/* Blockquotes */
.nic-prose blockquote,
.page-body blockquote,
.blog-single__content blockquote,
.entry-content blockquote {
  margin: 1.4em 0;
  padding: 0.55em 0 0.55em 1.15em;
  border-left: 3px solid var(--nic-prose-heading);
  color: var(--nic-prose-muted);
  font-style: italic;
  max-width: var(--nic-prose-measure);
}

/* Images & figures */
.nic-prose img,
.page-body img,
.blog-single__content img,
.woocommerce-Tabs-panel--description img,
.entry-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius, 6px);
  margin: 1.35em 0;
}

.nic-prose figure,
.page-body figure,
.blog-single__content figure,
.entry-content figure {
  margin: 1.35em 0;
  max-width: 100%;
}

.nic-prose figcaption,
.page-body figcaption,
.blog-single__content figcaption,
.entry-content figcaption {
  margin-top: 0.45em;
  font-size: 0.875rem;
  color: var(--nic-prose-muted);
  line-height: 1.5;
}

/* Tables — scroll safely on narrow viewports */
.nic-prose .nic-table-wrap,
.page-body .nic-table-wrap,
.blog-single__content .nic-table-wrap,
.woocommerce-Tabs-panel .nic-table-wrap,
.entry-content .nic-table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.35em 0;
}

.nic-prose table,
.page-body table,
.blog-single__content table,
.woocommerce-Tabs-panel--description table,
.woocommerce-Tabs-panel--additional_information table,
.entry-content table,
.shop_attributes {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: var(--nic-prose-size-sm);
  margin: 1.35em 0;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nic-prose th,
.nic-prose td,
.page-body th,
.page-body td,
.blog-single__content th,
.blog-single__content td,
.woocommerce-Tabs-panel--description th,
.woocommerce-Tabs-panel--description td,
.woocommerce-Tabs-panel--additional_information th,
.woocommerce-Tabs-panel--additional_information td,
.entry-content th,
.entry-content td,
.shop_attributes th,
.shop_attributes td {
  padding: 0.65em 0.9em;
  border: 1px solid var(--nic-prose-border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.nic-prose th,
.page-body th,
.blog-single__content th,
.woocommerce-Tabs-panel--description th,
.entry-content th,
.shop_attributes th {
  background: var(--nic-prose-surface);
  font-weight: 600;
  color: var(--nic-prose-heading);
  white-space: nowrap;
}

/* Short description callout (product summary only — not cards) */
.single-product .sp-short-desc,
.single-product .product-short-desc,
.single-product .woocommerce-product-details__short-description {
  max-width: var(--nic-prose-measure);
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  background: #f0f5fb;
  border-left: 3px solid var(--nic-prose-heading);
  border-radius: 0 6px 6px 0;
  font-size: var(--nic-prose-size-sm);
  line-height: 1.7;
  color: #444;
}

/* FAQ answers share prose rhythm without becoming cards */
.faq-answer {
  font-size: var(--nic-prose-size-sm);
  line-height: var(--nic-prose-lh);
  color: #4a5568;
  max-width: var(--nic-prose-measure);
}

.faq-question {
  overflow-wrap: anywhere;
  gap: 12px;
}

/* Page shell */
.page-content {
  padding: 48px 20px 80px;
}

.page-inner {
  max-width: var(--container, 1280px);
  margin: 0 auto;
}

/* Reading measure only for content pages that opt into prose */
.page-inner:has(> .nic-prose),
.page-content:has(.nic-prose) .page-inner {
  max-width: 42rem; /* ~672px reading column */
}

body.woocommerce-cart .page-inner,
body.woocommerce-checkout .page-inner,
body.woocommerce-account .page-inner {
  max-width: var(--container, 1280px);
}

/* Article shell (moved out of single.php inline <style>) */
.blog-single {
  padding: 48px 0 80px;
}

.blog-single__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--nic-prose-muted);
  margin-bottom: 32px;
  transition: color 0.15s;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.blog-single__back:hover {
  color: var(--nic-prose-link);
}

.blog-single__back svg {
  flex-shrink: 0;
}

.blog-single__hero {
  border-radius: var(--radius-lg, 12px);
  overflow: hidden;
  margin-bottom: 36px;
  aspect-ratio: 16 / 6;
  background: var(--nic-prose-surface);
}

.blog-single__hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
  border-radius: 0;
}

.blog-single__header {
  margin-bottom: 28px;
}

.blog-single__date {
  font-size: 0.875rem;
  color: var(--nic-prose-muted);
  margin-bottom: 12px;
  display: block;
}

.blog-single__title {
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  color: var(--color-text, #1a1a1a);
  line-height: 1.25;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.blog-single__footer {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--nic-prose-border);
}

@media (max-width: 680px) {
  .blog-single {
    padding: 32px 0 60px;
  }

  .blog-single__hero {
    aspect-ratio: 16 / 9;
  }
}

/*
 * Hard exclusions: product-card and checkout chrome are not prose.
 * Language switcher (.nic-lang-switcher*) is owned by Agent 3 — do not
 * nest switcher rules here.
 *
 * Cart/checkout/account pages use page.php wrappers; neutralize prose there
 * even if a nic-prose class is present from older markup.
 */
body.woocommerce-cart .page-body,
body.woocommerce-checkout .page-body,
body.woocommerce-account .page-body,
body.woocommerce-cart .nic-prose,
body.woocommerce-checkout .nic-prose,
body.woocommerce-account .nic-prose {
  max-width: none;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  hyphens: manual;
  overflow-wrap: normal;
}

body.woocommerce-cart .page-body p,
body.woocommerce-checkout .page-body p,
body.woocommerce-account .page-body p,
body.woocommerce-cart .page-body a,
body.woocommerce-checkout .page-body a,
body.woocommerce-account .page-body a,
body.woocommerce-cart .page-body ul,
body.woocommerce-checkout .page-body ul,
body.woocommerce-account .page-body ul {
  max-width: none;
  list-style: none;
  margin: revert;
  padding: revert;
  text-decoration: none;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

.page-body .wp-block-woocommerce-cart,
.page-body .wp-block-woocommerce-checkout,
.page-body .wc-block-cart,
.page-body .wc-block-checkout,
.page-body .woocommerce {
  max-width: none;
}

/*
 * Blocks checkout payment headers (e.g. Nexi): prose image margins make the
 * logo stretch the radio row and misalign radio / title / logos. Keep the
 * selected border and accordion content (description / errors) untouched.
 */
.page-body .wc-block-checkout__payment-method .wc-block-components-radio-control__label > div {
  align-items: center;
  flex-wrap: wrap;
  row-gap: 8px;
  min-width: 0;
}

.page-body .wc-block-checkout__payment-method .wc-block-components-radio-control__label > div > span {
  align-self: center;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
}

.page-body .wc-block-checkout__payment-method .wc-block-components-radio-control__label img {
  margin: 0;
  border-radius: 0;
  flex: 0 0 auto;
  max-height: 24px;
  width: auto;
  height: 24px;
}

/* Collapse empty gateway description chrome; keep real copy / notices / errors. */
.page-body .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-content p:empty {
  display: none;
  margin: 0;
}

.page-body .wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-content:has(> div > p:only-child:empty):not(:has(.wc-block-components-notice-banner, .woocommerce-error, [role="alert"])) {
  padding-top: 0;
  padding-bottom: 0;
}

ul.products li.product p,
ul.products li.product ul,
ul.products li.product ol,
.pc-card p,
.pc-card ul,
.products .woocommerce-loop-product__title {
  max-width: none;
}

ul.products li.product ul,
.pc-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Mobile readability */
@media (max-width: 768px) {
  .nic-prose,
  .page-body,
  .blog-single__content,
  .homepage-seo-text,
  .sp-short-desc,
  .product-short-desc,
  .woocommerce-product-details__short-description,
  .woocommerce-Tabs-panel--description,
  .entry-content {
    font-size: 1rem;
    line-height: 1.7;
  }

  .page-content {
    padding: 32px 16px 56px;
  }

  .page-inner {
    max-width: 100%;
  }

  .nic-prose h1,
  .page-body h1,
  .blog-single__content h1 {
    font-size: 1.55rem;
    margin-bottom: 0.9em;
  }

  .nic-prose h2,
  .page-body h2,
  .blog-single__content h2,
  .homepage-seo-text h2,
  .woocommerce-Tabs-panel--description h2 {
    font-size: 1.2rem;
    margin-top: 1.35em;
  }

  .nic-prose th,
  .page-body th,
  .blog-single__content th,
  .entry-content th,
  .shop_attributes th {
    white-space: normal;
  }
}

@media (max-width: 480px) {
  .nic-prose ul,
  .page-body ul,
  .blog-single__content ul,
  .woocommerce-Tabs-panel--description ul,
  .entry-content ul,
  .nic-prose ol,
  .page-body ol,
  .blog-single__content ol,
  .woocommerce-Tabs-panel--description ol,
  .entry-content ol {
    padding-left: 1.15em;
  }
}
