/*
 * Pillar Content Master Stylesheet – 4D King Results
 *
 * Comprehensive styling for Gutenberg blocks within pillar/editorial articles,
 * standard pages, and single posts. Matches the site's red/white/dark palette.
 *
 * Mobile‑first, responsive, scoped to .pillar-article, .page-content, .post-content.
 */

/* =====================================================================
   DESIGN TOKENS
   ===================================================================== */
:root {
  --pillar-heading-color:      var(--dark, #111111);
  --pillar-text-color:         var(--grey, #666666);
  --pillar-accent:             var(--primary-red, #cc0000);
  --pillar-accent-light:       #f5cccc;
  --pillar-accent-pale:        #fff5f5;
  --pillar-border-color:       var(--border-color, #e0e0e0);
  --pillar-bg:                 var(--white, #ffffff);
  --pillar-code-bg:            #1e1e1e;
  --pillar-code-text:          #d4d4d4;
  --pillar-table-stripe:       #fafafa;
  --pillar-shadow:             0 2px 8px rgba(0,0,0,0.06);
  --pillar-radius:             8px;
  --pillar-transition:         0.2s ease;
  --pillar-font-family:        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* =====================================================================
   1. TYPOGRAPHY & TEXT FRAMEWORKS
   ===================================================================== */

/* ----- Headings H2, H3, H4 ----- */
.pillar-article h2, .page-content h2, .post-content h2,
.pillar-article h3, .page-content h3, .post-content h3,
.pillar-article h4, .page-content h4, .post-content h4,
.wp-block-heading {
  color: var(--pillar-heading-color);
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  position: relative;
}

.pillar-article h2, .page-content h2, .post-content h2,
.wp-block-heading[class*="h2"] {
  font-size: 2rem;
  padding-left: 1.25rem;
  border-left: 5px solid var(--pillar-accent);
  background: linear-gradient(to right, var(--pillar-accent-pale), transparent 80%);
  background-size: 100% 2px;
  background-position: left bottom;
  background-repeat: no-repeat;
  padding-bottom: 0.75rem;
}

.pillar-article h3, .page-content h3, .post-content h3,
.wp-block-heading[class*="h3"] {
  font-size: 1.5rem;
  border-left: 3px solid var(--pillar-accent);
  padding-left: 1rem;
  letter-spacing: -0.01em;
}

.pillar-article h4, .page-content h4, .post-content h4,
.wp-block-heading[class*="h4"] {
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--pillar-accent);
}

/* ----- Lead Paragraph / Drop Caps ----- */
.pillar-article p.has-drop-cap:first-letter,
.page-content p.has-drop-cap:first-letter,
.post-content p.has-drop-cap:first-letter {
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 0.8;
  float: left;
  margin: 0.15em 0.1em 0 0;
  color: var(--pillar-accent);
  font-family: "Times New Roman", serif;
}

.pillar-article .lead-text,
.page-content .lead-text,
.post-content .lead-text,
.pillar-article > p:first-of-type,
.page-content > p:first-of-type,
.post-content > p:first-of-type {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--pillar-heading-color);
  line-height: 1.7;
  margin-bottom: 2rem;
}

/* ----- Blockquotes ----- */
.wp-block-quote,
.pillar-article blockquote,
.page-content blockquote,
.post-content blockquote {
  margin: 2.5rem 0;
  padding: 2rem 2.5rem;
  background: var(--pillar-accent-pale);
  border-left: 5px solid var(--pillar-accent);
  border-radius: var(--pillar-radius);
  position: relative;
  font-style: italic;
  color: var(--pillar-heading-color);
  box-shadow: var(--pillar-shadow);
}

.wp-block-quote::before,
.pillar-article blockquote::before,
.page-content blockquote::before,
.post-content blockquote::before {
  content: "“";
  font-size: 4rem;
  color: var(--pillar-accent);
  position: absolute;
  top: -10px;
  left: 15px;
  font-family: "Times New Roman", serif;
  line-height: 1;
  opacity: 0.3;
}

.wp-block-quote cite,
.pillar-article blockquote cite,
.page-content blockquote cite,
.post-content blockquote cite {
  display: block;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--pillar-text-color);
  font-style: normal;
}

/* ----- Pullquotes ----- */
.wp-block-pullquote {
  text-align: center;
  margin: 2.5rem 0;
  padding: 2rem 0;
  border-top: 2px solid var(--pillar-accent);
  border-bottom: 2px solid var(--pillar-accent);
  background: transparent;
}

.wp-block-pullquote blockquote {
  background: none;
  border: none;
  padding: 0;
  box-shadow: none;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--pillar-heading-color);
}

.wp-block-pullquote::before,
.wp-block-pullquote::after {
  content: none;
}

/* ----- Citations & Captions ----- */
.wp-block-image figcaption,
.pillar-article figcaption,
.page-content figcaption,
.post-content figcaption,
.pillar-article .wp-caption-text,
.page-content .wp-caption-text,
.post-content .wp-caption-text {
  font-size: 0.85rem;
  color: var(--pillar-text-color);
  text-align: center;
  margin-top: 0.5rem;
  font-style: italic;
}

/* ----- Inline Highlights / Marks ----- */
.pillar-highlight,
mark {
  background: linear-gradient(120deg, var(--pillar-accent-light) 0%, var(--pillar-accent-light) 100%);
  background-repeat: no-repeat;
  background-size: 100% 40%;
  background-position: 0 90%;
  padding: 0 0.15rem;
  font-weight: 600;
  color: var(--pillar-heading-color);
}

/* =====================================================================
   2. LISTS & SEQUENTIAL STEPS
   ===================================================================== */

/* ----- Ordered List (Connected Timeline) ----- */
.pillar-article ol:not([class]),
.page-content ol:not([class]),
.post-content ol:not([class]) {
  counter-reset: timeline-counter;
  list-style: none;
  padding-left: 0;
  margin: 2rem 0;
}

.pillar-article ol:not([class]) li,
.page-content ol:not([class]) li,
.post-content ol:not([class]) li {
  counter-increment: timeline-counter;
  position: relative;
  padding-left: 3.5rem;
  margin-bottom: 2rem;
  min-height: 2.5rem;
}

.pillar-article ol:not([class]) li::before,
.page-content ol:not([class]) li::before,
.post-content ol:not([class]) li::before {
  content: counter(timeline-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--pillar-accent);
  color: #fff;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(204,0,0,0.3);
  z-index: 1;
}

/* Vertical connector line */
.pillar-article ol:not([class]) li::after,
.page-content ol:not([class]) li::after,
.post-content ol:not([class]) li::after {
  content: "";
  position: absolute;
  left: 1.2rem;
  top: 2.8rem;
  bottom: -2rem;
  width: 2px;
  background: repeating-linear-gradient(to bottom, var(--pillar-accent) 0, var(--pillar-accent) 4px, transparent 4px, transparent 8px);
  z-index: 0;
}

.pillar-article ol:not([class]) li:last-child::after,
.page-content ol:not([class]) li:last-child::after,
.post-content ol:not([class]) li:last-child::after {
  display: none;
}

/* ----- Unordered List (Iconized) ----- */
.pillar-article ul:not([class]),
.page-content ul:not([class]),
.post-content ul:not([class]) {
  list-style: none;
  padding-left: 0;
  margin: 2rem 0;
}

.pillar-article ul:not([class]) li,
.page-content ul:not([class]) li,
.post-content ul:not([class]) li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 0.75rem;
}

.pillar-article ul:not([class]) li::before,
.page-content ul:not([class]) li::before,
.post-content ul:not([class]) li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.4em;
  width: 1rem;
  height: 1rem;
  background: var(--pillar-accent);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") no-repeat center;
  mask-size: contain;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") no-repeat center;
  -webkit-mask-size: contain;
}

/* =====================================================================
   3. DATA PRESENTATION & LAYOUT ELEMENTS
   ===================================================================== */

/* ----- Tables ----- */
.wp-block-table,
.pillar-article table,
.page-content table,
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.95rem;
  box-shadow: var(--pillar-shadow);
  border-radius: var(--pillar-radius);
  overflow: hidden;
}

.wp-block-table thead,
.pillar-article table thead,
.page-content table thead,
.post-content table thead {
  background: var(--pillar-accent);
  color: #fff;
}

.wp-block-table th,
.pillar-article table th,
.page-content table th,
.post-content table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2;
}

.wp-block-table td,
.pillar-article table td,
.page-content table td,
.post-content table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--pillar-border-color);
}

.wp-block-table tbody tr:nth-child(even),
.pillar-article table tbody tr:nth-child(even),
.page-content table tbody tr:nth-child(even),
.post-content table tbody tr:nth-child(even) {
  background: var(--pillar-table-stripe);
}

/* Responsive table wrapper for small screens */
.wp-block-table.is-style-scrollable {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

/* ----- Code & Preformatted ----- */
.wp-block-code,
.pillar-article pre,
.page-content pre,
.post-content pre {
  background: var(--pillar-code-bg);
  color: var(--pillar-code-text);
  padding: 1.5rem;
  border-radius: var(--pillar-radius);
  overflow-x: auto;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  position: relative;
  margin: 2rem 0;
}

.wp-block-code code {
  background: none;
  padding: 0;
}

/* Line numbers (optional) */
.pillar-article pre.line-numbers,
.page-content pre.line-numbers,
.post-content pre.line-numbers {
  counter-reset: line;
}

.pillar-article pre.line-numbers code > .line,
.page-content pre.line-numbers code > .line,
.post-content pre.line-numbers code > .line {
  counter-increment: line;
  display: block;
  padding-left: 3rem;
  position: relative;
}

.pillar-article pre.line-numbers code > .line::before,
.page-content pre.line-numbers code > .line::before,
.post-content pre.line-numbers code > .line::before {
  content: counter(line);
  position: absolute;
  left: 0;
  color: #888;
  width: 2rem;
  text-align: right;
}

/* Copy button (hidden, shown on hover via JS, style here) */
.pillar-article .code-copy-btn,
.page-content .code-copy-btn,
.post-content .code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.pillar-article pre:hover .code-copy-btn,
.page-content pre:hover .code-copy-btn,
.post-content pre:hover .code-copy-btn {
  opacity: 1;
}

/* ----- Accordions / Details (FAQ) ----- */
.wp-block-details,
.pillar-article details,
.page-content details,
.post-content details {
  margin: 1.5rem 0;
  border: 1px solid var(--pillar-border-color);
  border-radius: var(--pillar-radius);
  overflow: hidden;
  transition: all var(--pillar-transition);
}

.wp-block-details summary,
.pillar-article details summary,
.page-content details summary,
.post-content details summary {
  padding: 1rem 1.5rem;
  font-weight: 700;
  background: var(--pillar-accent-pale);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
}

.wp-block-details summary::-webkit-details-marker,
.pillar-article details summary::-webkit-details-marker,
.page-content details summary::-webkit-details-marker,
.post-content details summary::-webkit-details-marker {
  display: none;
}

.wp-block-details summary::after,
.pillar-article details summary::after,
.page-content details summary::after,
.post-content details summary::after {
  content: "+";
  font-size: 1.5rem;
  color: var(--pillar-accent);
  transition: transform 0.2s;
}

.wp-block-details[open] summary::after,
.pillar-article details[open] summary::after,
.page-content details[open] summary::after,
.post-content details[open] summary::after {
  transform: rotate(45deg);
}

.wp-block-details .wp-block-details-content,
.pillar-article details .details-content,
.page-content details .details-content,
.post-content details .details-content {
  padding: 1.5rem;
  line-height: 1.6;
}

/* ----- Callout Boxes (Info, Success, Warning, Danger) ----- */
.pillar-callout {
  padding: 1.5rem 1.5rem 1.5rem 3.5rem;
  margin: 2rem 0;
  border-radius: var(--pillar-radius);
  position: relative;
  box-shadow: var(--pillar-shadow);
}

.pillar-callout::before {
  content: "";
  position: absolute;
  left: 1.2rem;
  top: 1.5rem;
  width: 1.5rem;
  height: 1.5rem;
  mask-size: contain;
  -webkit-mask-size: contain;
}

.pillar-callout--info {
  background: #e3f2fd;
  border-left: 5px solid #1976d2;
}
.pillar-callout--info::before {
  background: #1976d2;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='16' x2='12' y2='12'/%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'/%3E%3C/svg%3E") no-repeat center;
}

.pillar-callout--success {
  background: #e8f5e9;
  border-left: 5px solid #2e7d32;
}
.pillar-callout--success::before {
  background: #2e7d32;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/%3E%3Cpolyline points='22 4 12 14.01 9 11.01'/%3E%3C/svg%3E") no-repeat center;
}

.pillar-callout--warning {
  background: #fff3e0;
  border-left: 5px solid #f57c00;
}
.pillar-callout--warning::before {
  background: #f57c00;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E") no-repeat center;
}

.pillar-callout--danger {
  background: #ffebee;
  border-left: 5px solid #c62828;
}
.pillar-callout--danger::before {
  background: #c62828;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='15' y1='9' x2='9' y2='15'/%3E%3Cline x1='9' y1='9' x2='15' y2='15'/%3E%3C/svg%3E") no-repeat center;
}

/* ----- Columns (Gutenberg) ----- */
.wp-block-columns {
  display: flex;
  gap: 2rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.wp-block-column {
  flex: 1 1 0;
  min-width: 0;
}

@media (max-width: 768px) {
  .wp-block-columns {
    flex-direction: column;
  }
}

/* ----- Separators (HR) ----- */
.wp-block-separator,
.pillar-article hr,
.page-content hr,
.post-content hr {
  border: none;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--pillar-accent), transparent);
  margin: 3rem 0;
  opacity: 0.6;
}

.wp-block-separator.is-style-dots,
.pillar-article hr.is-style-dots,
.page-content hr.is-style-dots,
.post-content hr.is-style-dots {
  background: none;
  height: auto;
}

.wp-block-separator.is-style-dots::before {
  color: var(--pillar-accent);
}

/* ----- Buttons ----- */
.wp-block-button__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 2rem;
  border-radius: 30px;
  font-weight: 700;
  text-decoration: none;
  transition: background var(--pillar-transition), transform var(--pillar-transition), box-shadow var(--pillar-transition);
  cursor: pointer;
  border: 2px solid transparent;
}

.wp-block-button__link.has-primary-background {
  background: var(--pillar-accent);
  color: #fff;
}

.wp-block-button__link.has-primary-background:hover {
  background: var(--primary-hover, #a00000);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(204,0,0,0.3);
}

.wp-block-button.is-style-outline .wp-block-button__link {
  background: transparent;
  border: 2px solid var(--pillar-accent);
  color: var(--pillar-accent);
}

.wp-block-button.is-style-outline .wp-block-button__link:hover {
  background: var(--pillar-accent);
  color: #fff;
}

/* =====================================================================
   4. MEDIA & EMBEDDED ASSETS
   ===================================================================== */

/* ----- Single Image ----- */
.wp-block-image img,
.pillar-article img:not(.avatar),
.page-content img:not(.avatar),
.post-content img:not(.avatar) {
  border-radius: var(--pillar-radius);
  box-shadow: var(--pillar-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: block;
  max-width: 100%;
  height: auto;
}

.wp-block-image img:hover,
.pillar-article img:not(.avatar):hover,
.page-content img:not(.avatar):hover,
.post-content img:not(.avatar):hover {
  transform: scale(1.02);
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

/* ----- Image Gallery ----- */
.wp-block-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 2rem 0;
}

.wp-block-gallery .wp-block-image {
  flex: 1 1 calc(33.333% - 1rem);
  min-width: 250px;
}

/* ----- Cover Blocks ----- */
.wp-block-cover {
  margin: 2rem 0;
  border-radius: var(--pillar-radius);
  overflow: hidden;
  position: relative;
}

.wp-block-cover__inner-container {
  z-index: 1;
  padding: 2rem;
}

.wp-block-cover.has-background-dim::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
}

/* ----- Media & Text Splits ----- */
.wp-block-media-text {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
  margin: 2rem 0;
}

.wp-block-media-text .wp-block-media-text__media {
  border-radius: var(--pillar-radius);
  overflow: hidden;
}

@media (max-width: 768px) {
  .wp-block-media-text {
    grid-template-columns: 1fr;
  }
}

/* ----- Video / Audio Players ----- */
.wp-block-video,
.wp-block-audio {
  margin: 2rem 0;
  border-radius: var(--pillar-radius);
  overflow: hidden;
  box-shadow: var(--pillar-shadow);
}

/* Maintain 16:9 aspect ratio for videos */
.wp-block-video {
  aspect-ratio: 16 / 9;
  background: #000;
}

.wp-block-video video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* =====================================================================
   5. NAVIGATION, LINKS & SPECIALISED UTILITIES
   ===================================================================== */

/* ----- Inline Hyperlinks ----- */
.pillar-article a:not([class]),
.page-content a:not([class]),
.post-content a:not([class]) {
  color: var(--pillar-accent);
  text-decoration: none;
  font-weight: 500;
  position: relative;
  transition: color 0.2s;
}

.pillar-article a:not([class])::after,
.page-content a:not([class])::after,
.post-content a:not([class])::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: var(--pillar-accent);
  transition: width 0.25s ease;
}

.pillar-article a:not([class]):hover::after,
.page-content a:not([class]):hover::after,
.post-content a:not([class]):hover::after {
  width: 100%;
}

/* ----- Social Sharing Modules ----- */
.pillar-social-share {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 2rem 0;
}

.pillar-social-share a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--pillar-accent-pale);
  color: var(--pillar-accent);
  transition: background 0.2s, color 0.2s;
}

.pillar-social-share a:hover {
  background: var(--pillar-accent);
  color: #fff;
}

/* ----- File / Asset Download Blocks ----- */
.wp-block-file {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border: 1px solid var(--pillar-border-color);
  border-radius: var(--pillar-radius);
  background: var(--pillar-accent-pale);
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.wp-block-file a {
  font-weight: 600;
  color: var(--pillar-accent);
}

.wp-block-file .wp-block-file__size {
  color: var(--pillar-text-color);
  font-size: 0.85rem;
}

/* =====================================================================
   6. PARAGRAPH SPACING (explicit breathing room)
   ===================================================================== */
.pillar-article p,
.page-content p,
.post-content p {
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

/* =====================================================================
   7. RESPONSIVE FINE‑TUNING
   ===================================================================== */
@media (max-width: 768px) {
  .pillar-article h2, .page-content h2, .post-content h2 {
    font-size: 1.6rem;
    padding-left: 1rem;
  }
  .pillar-article h3, .page-content h3, .post-content h3 {
    font-size: 1.3rem;
  }
  .pillar-article h4, .page-content h4, .post-content h4 {
    font-size: 1.1rem;
  }
  .wp-block-quote,
  .pillar-article blockquote,
  .page-content blockquote,
  .post-content blockquote {
    padding: 1.5rem;
  }
}