/**
 * Personalitopia Modular Block Styles: Core Paragraph Block (core/paragraph)
 * Theme: twentytwentyfour-child
 */

p,
.wp-block-paragraph {
  margin-top: 0;
  margin-bottom: var(--wp--preset--spacing--20, 12px);
  line-height: 1.7;
}

.entry-content p,
.wp-block-post-content p {
  margin-top: 0;
  margin-bottom: var(--wp--preset--spacing--20, 12px);
  line-height: 1.7;
}

  /* Lead Deck Paragraph Variation */
  p.is-style-lead-deck,
  .wp-block-paragraph.is-style-lead-deck {
    font-family: var(--wp--preset--font-family--body, 'Crimson Pro', Georgia, serif);
    font-size: 1.32rem;
    line-height: 1.62;
    color: var(--wp--preset--color--ink, #2C1F15);
    opacity: 0.92;
    margin-bottom: 24px;
  }

  /* Terracotta Drop-Cap Variation */
  p.is-style-drop-cap-terracotta::first-letter,
  .wp-block-paragraph.is-style-drop-cap-terracotta::first-letter {
    font-family: var(--wp--preset--font-family--heading, 'Fraunces', Georgia, serif);
    font-size: 3.8rem;
    float: left;
    line-height: 0.78;
    padding-right: 14px;
    padding-top: 4px;
    color: var(--wp--preset--color--terracotta, #B8674A);
    font-weight: 500;
  }

  /* Editorial Aside Callout Variation */
  p.is-style-editorial-aside,
  .wp-block-paragraph.is-style-editorial-aside {
    background: rgba(184, 103, 74, 0.06);
    border-left: 3px solid var(--wp--preset--color--terracotta, #B8674A);
    border-radius: 0 var(--wp--custom--radius--btn, 8px) var(--wp--custom--radius--btn, 8px) 0;
    padding: 16px 20px;
    margin: 24px 0;
    font-family: var(--wp--preset--font-family--body, 'Crimson Pro', Georgia, serif);
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--wp--preset--color--contrast-2, #3D2C20);
  }

  /* Lead Essay Variation */
  .wp-block-paragraph.is-style-pt-lead-essay {
    font-family: var(--wp--preset--font-family--body, 'Crimson Pro', Georgia, serif);
    font-size: 18px;
    line-height: 1.65;
    color: var(--wp--preset--color--ink, #2C1F15);
  }

  /* Old Parchment Text Variation */
  .wp-block-paragraph.is-style-pt-old-parchment-text {
    font-family: var(--wp--preset--font-family--body, Georgia, serif);
    background-color: #FAF2DF;
    border-left: 3px solid var(--wp--preset--color--gold, #C9A563);
    padding: 12px 18px;
    font-size: 15px;
    color: var(--wp--preset--color--contrast-2, #3d2f23);
  }

  /* Website Reference Variation */
  .wp-block-paragraph.is-style-pt-website-reference {
    background: var(--wp--preset--color--paper, #FBF5E8);
    border: 1px solid rgba(44, 31, 21, 0.1);
    border-radius: var(--wp--custom--radius--btn, 8px);
    padding: 16px 20px 16px 44px;
    position: relative;
    font-size: 14px;
    line-height: 1.5;
  }

  .wp-block-paragraph.is-style-pt-website-reference::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23B8674A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>');
    background-repeat: no-repeat;
  }

  /* ==========================================================================
     Stat Source & Interactive Fact Verification Tooltip (.pt-stat-source)
     ========================================================================== */
  .pt-stat-source,
  .stat-source {
    position: relative;
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    cursor: pointer;
    text-decoration: none;
    font-feature-settings: "tnum" 1;
    border-bottom: 1.5px dotted var(--wp--preset--color--terracotta, #B8674A);
    color: inherit;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
    border-radius: 2px;
    padding: 0 2px;
    vertical-align: baseline;
  }

  .pt-stat-source:hover,
  .pt-stat-source:focus,
  .pt-stat-source:focus-within,
  .pt-stat-source.is-active,
  .stat-source:hover,
  .stat-source:focus,
  .stat-source:focus-within,
  .stat-source.is-active {
    color: var(--wp--preset--color--terracotta, #B8674A);
    background-color: rgba(184, 103, 74, 0.08);
    outline: none;
  }

  /* Subtle superscript indicator */
  .pt-stat-indicator {
    font-size: 0.7em;
    line-height: 1;
    vertical-align: super;
    color: var(--wp--preset--color--terracotta, #B8674A);
    opacity: 0.85;
    margin-left: 1px;
    font-weight: 600;
    user-select: none;
  }

  /* The Popup Card */
  .pt-stat-popup {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(calc(-50% + var(--pt-stat-shift-x, 0px))) translateY(6px);
    width: max-content;
    min-width: 210px;
    max-width: min(340px, calc(100vw - 32px));
    background-color: var(--wp--preset--color--base-2, #FAF6EC);
    border: 1px solid var(--wp--preset--color--border-subtle, #E6E3DC);
    border-radius: var(--wp--custom--radius--card, 12px);
    box-shadow: 0 10px 28px -4px rgba(44, 31, 21, 0.14), 0 4px 12px -2px rgba(44, 31, 21, 0.08);
    padding: 14px 16px;
    box-sizing: border-box;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: var(--wp--preset--font-family--body, 'Crimson Pro', Georgia, serif);
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--wp--preset--color--ink, #2C1F15);
    font-weight: normal;
    text-align: left;
    white-space: normal;
  }

  /* Downward arrow pointer (default: popup is above trigger) */
  .pt-stat-popup::after {
    content: "";
    position: absolute;
    top: 100%;
    left: calc(50% - var(--pt-stat-shift-x, 0px));
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: var(--wp--preset--color--base-2, #FAF6EC) transparent transparent transparent;
  }

  .pt-stat-popup::before {
    content: "";
    position: absolute;
    top: 100%;
    left: calc(50% - var(--pt-stat-shift-x, 0px));
    transform: translateX(-50%);
    border-width: 7px 7px 0 7px;
    border-style: solid;
    border-color: var(--wp--preset--color--border-subtle, #E6E3DC) transparent transparent transparent;
    z-index: -1;
  }

  /* Upward arrow pointer (when flipped below trigger) */
  .pt-stat-source.pt-stat-flipped .pt-stat-popup,
  .stat-source.pt-stat-flipped .pt-stat-popup {
    bottom: auto;
    top: calc(100% + 10px);
    transform: translateX(calc(-50% + var(--pt-stat-shift-x, 0px))) translateY(-6px);
  }

  .pt-stat-source.pt-stat-flipped .pt-stat-popup::after,
  .stat-source.pt-stat-flipped .pt-stat-popup::after {
    top: auto;
    bottom: 100%;
    border-width: 0 6px 6px 6px;
    border-color: transparent transparent var(--wp--preset--color--base-2, #FAF6EC) transparent;
  }

  .pt-stat-source.pt-stat-flipped .pt-stat-popup::before,
  .stat-source.pt-stat-flipped .pt-stat-popup::before {
    top: auto;
    bottom: 100%;
    border-width: 0 7px 7px 7px;
    border-color: transparent transparent var(--wp--preset--color--border-subtle, #E6E3DC) transparent;
  }

  /* Popup open states */
  .pt-stat-source:hover .pt-stat-popup,
  .pt-stat-source:focus-within .pt-stat-popup,
  .pt-stat-source.is-active .pt-stat-popup,
  .stat-source:hover .pt-stat-popup,
  .stat-source:focus-within .pt-stat-popup,
  .stat-source.is-active .pt-stat-popup {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(calc(-50% + var(--pt-stat-shift-x, 0px))) translateY(0);
  }

  /* Header row with badge & year */
  .pt-stat-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-family: var(--wp--preset--font-family--heading, 'Instrument Sans', -apple-system, sans-serif);
    font-size: 0.78rem;
  }

  .pt-stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 9999px;
    background-color: rgba(184, 103, 74, 0.1);
    color: var(--wp--preset--color--terracotta, #B8674A);
    font-weight: 600;
  }

  .pt-stat-year {
    color: var(--wp--preset--color--text-muted, #787571);
    font-weight: 500;
  }

  /* Source Publisher / Organization */
  .pt-stat-source-name {
    font-family: var(--wp--preset--font-family--heading, 'Instrument Sans', -apple-system, sans-serif);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--wp--preset--color--ink, #2C1F15);
    margin: 0;
  }

  /* Note context */
  .pt-stat-note {
    font-size: 0.88rem;
    color: var(--wp--preset--color--contrast-2, #575551);
    margin: 0;
  }

  /* Source external link button */
  .pt-stat-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 4px;
    padding: 7px 14px;
    border-radius: var(--wp--custom--radius--btn, 8px);
    background-color: var(--wp--preset--color--terracotta, #B8674A);
    color: #FFFFFF;
    font-family: var(--wp--preset--font-family--heading, 'Instrument Sans', -apple-system, sans-serif);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.15s ease, transform 0.15s ease;
  }

  .pt-stat-link:hover,
  .pt-stat-link:focus {
    background-color: var(--wp--preset--color--terracotta-hover, #9E5338);
    color: #FFFFFF;
    transform: translateY(-1px);
  }

  .pt-stat-arrow {
    display: inline-block;
    font-size: 0.9em;
    transition: transform 0.15s ease;
  }

  .pt-stat-link:hover .pt-stat-arrow {
    transform: translate(2px, -2px);
  }

