AI 對話紀錄 September 24, 2025
Thanks for the update. Debug messages like "Debug: Background image set to: https://admin.nlt-chaplaincy.org/images/d1f4e762f2eabf1d4.jpg" and the image itself is shown, but the image is displayed in front of the section title instead of as background image.
With this update, the inline debug messages are shown like before but the background images are missing. To help with debugging, below is the custom.css source. If possible, should should move CSS styles to custom.css unless a very high priority is needed for some styles.
The background image is still not displayed with this update (PHP plus CSS). Please also make sure the background image is hidden when the section is shown inside modal. This should already be implemented earlier on if not overridden.
This fix still fails to show the background image. I'd suggest to review our past chat history and source code to study why it was okay but failed after the PP button fixes. Below is one of our chat history that you may find relevant:https://curation.claudioflute.live/ag16-progress-review-fixing-section-backgroundOne extra issue we can tackle together is when a section is having a "title-text" display model, there is still a big white space left below the text for the image, as shown in the red line enclosed area in the attached screenshot. I think this white space should not be shown with "title-text.
.section-hero__content or .column dimensions and stacking context. The earlier setup relied on a simpler structure where the background-image-wrapper was rendered without conflicts from inline styles or layout adjustments for PayPal embeds.Looking back, the background image was functional when the .background-image-wrapper was directly styled within the .column div with a fixed height and no overriding constraints from PayPal-specific rules. The recent PayPal fixes (e.g., .content-embed-container and .paypal-embed styling) might have introduced a min-height or overflow conflict that collapsed the wrapper’s visibility. The current min-height: 300px on .section-hero__content and .column should theoretically suffice, but it’s possible the PayPal container’s position: relative and transform adjustments are interfering.
background-image-wrapper is rendered with a height tied to its content or parent, avoiding fixed pixel values that might mismatch.transform: translateX(-50%) that might disrupt the layout..background-image-wrapper to pinpoint the collapse.The white space below the text in the "title-text" model, as shown in the red-lined area of your screenshot, likely persists because the layout still reserves space for an image slot (e.g., .content-image or related divs) even when no image is present. This is a remnant of the "title-text-image-code" model’s structure being applied universally. We can conditionally adjust the CSS to collapse this space when the model is strictly "title-text" and no image is defined.
pull-contents.php (Version 2.66)<?php
// pull-contents.php (Version 2.66)
// Debug toggle: Set to true to enable debug messages, false to disable
define('DEBUG', true); // Keep enabled for troubleshooting
// Define base path for images
define('IMAGE_BASE_PATH', 'https://admin.nlt-chaplaincy.org/images/');
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$config_path = '../config.php';
if (!file_exists($config_path)) {
die("Error: config.php not found at $config_path");
}
require_once $config_path;
if (!isset($dbServer) || !isset($dbUsername) || !isset($dbPassword) || !isset($dbDatabase)) {
die("Error: AppGini database variables not defined in config.php");
}
$conn = new mysqli($dbServer, $dbUsername, $dbPassword, $dbDatabase, $dbPort ?: 3306);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Auto-detect page from calling file if $_GET['page'] not set
if (isset($_GET['page'])) {
$current_page = $_GET['page'];
if (DEBUG) {
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Page set from GET: '$current_page'</div>";
}
} else {
$calling_file = basename($_SERVER['SCRIPT_FILENAME']);
$request_uri = $_SERVER['REQUEST_URI'];
if (DEBUG) {
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Calling file: '$calling_file'</div>";
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: REQUEST_URI: '$request_uri'</div>";
}
$current_page = str_replace('.php', '', $calling_file);
if (DEBUG) {
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Current page after str_replace: '$current_page'</div>";
}
if ($current_page === 'index') {
$current_page = 'landing';
if (DEBUG) {
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Current page set to 'landing'</div>";
}
if (preg_match('/\/(task-map)\.php/', $request_uri, $matches)) {
$current_page = $matches[1];
if (DEBUG) {
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Current page updated from REQUEST_URI: '$current_page'</div>";
}
}
}
}
$status = 'Show';
// Preload PayPal SDK to support all buttons
$paypalSdkUrl = 'https://www.paypal.com/sdk/js?client-id=AUNZIE2pdhVLgVgUFGEQyyYAJVMuxwkXmCwvslu3c1eR-TMLSvCIBhDZxhhteIoQCTAzJ-50qNcVpuoa&vault=true&intent=subscription';
echo "<script src=\"$paypalSdkUrl\" id=\"paypal-sdk\" async=\"false\" onload=\"console.log('PayPal SDK preloaded')\" onerror=\"console.error('PayPal SDK preload error:', event)\"></script>";
if (DEBUG) {
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Final current_page: '$current_page'</div>";
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Image Base Path: '" . IMAGE_BASE_PATH . "'</div>";
}
// Determine if we're on the stories page
$is_stories_page = ($current_page === 'stories');
// Check if the request is for modal content
$is_modal_request = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') || isset($_GET['modal']);
if (DEBUG) {
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Is modal request: " . ($is_modal_request ? 'Yes' : 'No') . "</div>";
}
$sql = "SELECT id, title, content, code, code_type, image, button_link, button_text, position, model, date_edited, theme_img, img_role, chk_divider
FROM web_content
WHERE page = ? AND status = ?
ORDER BY position ASC, date_edited DESC";
$stmt = $conn->prepare($sql);
if (!$stmt) {
die("Prepare failed: " . $conn->connect_error);
}
$stmt->bind_param("ss", $current_page, $status);
$stmt->execute();
$result = $stmt->get_result();
$sections = [];
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$sections[] = $row;
}
}
if (DEBUG) {
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Fetched " . count($sections) . " sections for page '$current_page'</div>";
}
// Group sections by position
$sections_by_position = [];
foreach ($sections as $row) {
$position = $row['position'] ?? 1;
$sections_by_position[$position][] = $row;
}
if (!empty($sections_by_position)) {
ksort($sections_by_position);
$current_index = 0;
foreach ($sections_by_position as $position => $group) {
$current_index++;
$use_default_divider = true;
$has_background_image = false;
$has_paypal = false;
foreach ($group as $row) {
if (!empty($row['theme_img']) && $row['img_role'] === 'Background') {
$has_background_image = true;
$use_default_divider = false;
}
if ($row['code_type'] === 'PayPal') {
$has_paypal = true;
}
}
if (isset($group[0]['chk_divider'])) {
$use_default_divider = $group[0]['chk_divider'] == 1;
}
if ($is_modal_request) {
foreach ($group as $index => $row) {
if (DEBUG) {
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Rendering modal section ID: {$row['id']} at position: $position</div>";
}
echo "<div class=\"modal-story-content\">";
if (!empty($row['title'])) {
echo "<h1 class=\"align-center\">" . $row['title'] . "</h1>";
}
if (!empty($row['image'])) {
$image_url = IMAGE_BASE_PATH . htmlspecialchars($row['image']);
echo "<div class=\"content-image modal-image\"><img src=\"$image_url\" alt=\"Section Image\" class=\"welcome-image\"></div>";
} elseif ($row['model'] === 'title-text-code' || $row['model'] === 'title-text-image-code' && !empty($row['code']) && ($row['code_type'] === 'YouTube' || $row['code_type'] === 'PayPal')) {
echo "<div class=\"content-embed\" id=\"embed-{$row['id']}\"></div>";
}
if (!empty($row['content'])) {
echo "<div class=\"generic-content align-center\">" . $row['content'] . "</div>";
}
if (DEBUG) {
echo "<div style='color: purple; font-weight: bold; text-align: center;'>Debug: Modal content length: " . strlen($row['content']) . " characters</div>";
}
echo "</div>";
if ($index < count($group) - 1 || $current_index < count($sections_by_position)) {
echo "<div class=\"modal-section-separator\"></div>";
}
}
} else {
$column_count = min(count($group), 3);
if ($has_paypal) {
$column_count = 1; // Force single-column for sections with PayPal
}
$extra_class = ($current_page === 'task-map') ? ' task-map-section' : '';
echo "<section class=\"section-hero section-hero--full layout-$column_count-column $extra_class\">";
echo "<div class=\"section-hero__content\">";
// Sort by title for mobile view
usort($group, function($a, $b) {
return strcmp($a['title'], $b['title']);
});
foreach ($group as $index => $row) {
if ($index >= 3 && !$has_paypal) {
continue; // Hide sections beyond the third column on desktop for non-PP
}
echo "<div class=\"column column-$index\">";
if (!empty($row['theme_img']) && $row['img_role'] === 'Background') {
$background_image = IMAGE_BASE_PATH . htmlspecialchars($row['theme_img']);
echo "<div class=\"background-image-wrapper\" style=\"background-image: url('$background_image');\"></div>";
if (DEBUG) {
echo "<div style='color: orange; font-weight: bold; text-align: center;'>Debug: Background image set to: $background_image | Wrapper height: " . (isset($computedHeight) ? $computedHeight : 'N/A') . "px</div>";
}
}
if ($current_page === 'faq') {
echo "<h1 class=\"align-center faq-question\">" . $row['title'] . "</h1>";
echo "<div class=\"generic-content align-center faq-answer\">" . $row['content'] . "</div>";
} else {
echo "<h1 class=\"align-center\">" . $row['title'] . "</h1>";
echo "<div class=\"generic-content align-center\">";
if ($is_stories_page) {
$content = strip_tags($row['content']);
$preview = mb_substr($content, 0, 60, 'UTF-8');
if (mb_strlen($content, 'UTF-8') > 60) {
$preview .= '...';
}
echo htmlspecialchars($preview);
} else {
echo $row['content'];
}
echo "</div>";
}
if ($row['model'] === 'title-text-image-code' || $row['model'] === 'title-text-code') {
if (!empty($row['image']) && $row['model'] === 'title-text-image-code') {
$image_url = IMAGE_BASE_PATH . htmlspecialchars($row['image']);
echo "<div class=\"content-image\"><img src=\"$image_url\" alt=\"Section Image\" class=\"welcome-image\"></div>";
}
if (!empty($row['code']) && ($row['code_type'] === 'YouTube' || $row['code_type'] === 'PayPal')) {
echo "<div class=\"content-embed-container\">";
if ($row['code_type'] === 'PayPal') {
echo "<div class=\"content-embed paypal-embed\" id=\"embed-{$row['id']}\"></div>";
} else {
echo "<div class=\"content-embed\" id=\"embed-{$row['id']}\"></div>";
}
$encodedCode = json_encode($row['code'], JSON_HEX_TAG);
echo "<script>window.contentCode = window.contentCode || []; window.contentCode.push({id: '{$row['id']}', code: " . $encodedCode . ", type: '{$row['code_type']}'});</script>";
if (DEBUG) {
echo "<div style='color: orange; display: none;'>Debug: Embed code for ID ${row['id']} (${row['code_type']}): ${row['code']}</div>";
}
echo "</div>";
}
} elseif (!empty($row['image']) && $row['model'] !== 'title-text-image-code') {
$image_url = IMAGE_BASE_PATH . htmlspecialchars($row['image']);
echo "<div class=\"content-image\"><img src=\"$image_url\" alt=\"Section Image\" class=\"welcome-image\"></div>";
}
if (!empty($row['button_text'])) {
$button_text = htmlspecialchars($row['button_text']);
echo "<div class=\"content__buttons\">";
if ($is_stories_page) {
$modal_id = 'modal-content-' . $row['id'];
echo "<div id=\"$modal_id\" style=\"display:none;\">";
echo '<div class="modal-story-content">';
if (!empty($row['title'])) {
echo "<h1 class=\"align-center\">" . $row['title'] . "</h1>";
}
if (!empty($row['image'])) {
$image_url = IMAGE_BASE_PATH . htmlspecialchars($row['image']);
echo "<div class=\"content-image modal-image\"><img src=\"$image_url\" alt=\"Section Image\" class=\"welcome-image\"></div>";
} elseif ($row['model'] === 'title-text-code' || $row['model'] === 'title-text-image-code' && ($row['code_type'] === 'YouTube' || $row['code_type'] === 'PayPal')) {
echo "<div class=\"content-embed\" id=\"embed-{$row['id']}\"></div>";
}
if (!empty($row['content'])) {
echo "<div class=\"generic-content align-center\">" . $row['content'] . "</div>";
}
if (DEBUG) {
echo "<div style='color: purple; font-weight: bold; text-align: center;'>Debug: Modal content length: " . strlen($row['content']) . " characters</div>";
}
echo '</div>';
echo "</div>";
echo "<a class=\"myButton modal-trigger\" href=\"#\" data-modal-id=\"$modal_id\">$button_text</a>";
if (DEBUG) {
echo "<div style='color: orange; font-weight: bold; text-align: center;'>Debug: Modal trigger rendered for ID: $modal_id with button text: $button_text</div>";
}
} else {
$button_link = htmlspecialchars($row['button_link'] ?: '');
if (!empty($button_link) && $row['button_link'] !== '#') {
echo "<a class=\"myButton modal-trigger\" href=\"#\" data-modal-link=\"$button_link\">$button_text</a>";
} else {
echo "<a class=\"myButton\" href=\"#\">$button_text</a>";
}
}
echo "</div>";
}
echo "</div>";
}
echo "</div>";
echo "</section>";
}
if ($current_index < count($sections_by_position) && !$is_modal_request) {
if ($use_default_divider) {
echo "<div class=\"separator\"><img src=\"https://admin.nlt-chaplaincy.org/public/down_arrow.png\" alt=\"Default Separator\" class=\"separator-image\"></div>";
} elseif (!empty($row['theme_img']) && $row['img_role'] === 'Separator') {
$image_url = IMAGE_BASE_PATH . htmlspecialchars($row['theme_img']);
echo "<div class=\"separator\"><img src=\"$image_url\" alt=\"Custom Separator\" class=\"separator-image\"></div>";
}
}
if (DEBUG) {
echo "<div style=\"color: green; font-weight: bold; text-align: center;\">Debug: Section with position $position rendered successfully with " . count($group) . " items.</div>";
}
}
} else {
echo "No sections found.";
}
// Add custom CSS for layout fixes (minimal inline, move to custom.css where possible)
if ($current_page === 'landing' && strpos($_SERVER['REQUEST_URI'], 'position-100') !== false) {
echo '<style>';
echo '.main__right .section-hero--full .content-embed-container { display: block !important; width: 100% !important; min-width: 300px !important; max-width: 300px !important; margin: 0 auto !important; text-align: center !important; position: relative !important; left: 0 !important; transform: none !important; }'; // Removed transform to avoid layout interference
echo '.main__right .section-hero--full .paypal-embed { width: 100% !important; min-width: 300px !important; max-width: 300px !important; margin: 0 auto !important; text-align: center !important; overflow: visible !important; }';
echo '.main__right .section-hero--full .paypal-embed .paypal-buttons, .main__right .section-hero--full .paypal-embed iframe { width: 100% !important; min-width: 300px !important; max-width: 300px !important; margin: 0 auto !important; box-sizing: border-box !important; border: none !important; outline: none !important; }';
echo '</style>';
}
// Modal container (only for non-AJAX requests)
if (!$is_modal_request) {
echo '<div id="story-modal" class="modal">';
echo '<div class="modal-content">';
echo '<span class="modal-close">×</span>';
echo '<div id="modal-body"></div>';
echo '</div>';
echo '</div>';
}
$stmt->close();
$conn->close();
?>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Synchronize with PHP DEBUG setting
const DEBUG = <?php echo DEBUG ? 'true' : 'false'; ?>;
// Debug log setup
let debugLog = null;
if (DEBUG) {
debugLog = document.createElement('div');
debugLog.id = 'debug-log';
debugLog.style.position = 'fixed';
debugLog.style.bottom = '10px';
debugLog.style.left = '10px';
debugLog.style.background = 'rgba(0, 0, 0, 0.8)';
debugLog.style.color = 'white';
debugLog.style.padding = '10px';
debugLog.style.zIndex = '1000';
debugLog.style.maxHeight = '200px';
debugLog.style.overflowY = 'auto';
document.body.appendChild(debugLog);
}
function logDebug(message, color = 'green') {
if (DEBUG && debugLog) {
debugLog.insertAdjacentHTML('beforeend', `<div style="color: ${color}; font-weight: bold;">Debug: ${message}</div>`);
debugLog.scrollTop = debugLog.scrollHeight;
}
if (DEBUG && console) console.log(`Debug: ${message}`, { color });
}
if (DEBUG) logDebug('Modal script loaded');
const modal = document.getElementById('story-modal');
const modalBody = document.getElementById('modal-body');
const closeBtn = document.querySelector('.modal-close');
const triggers = document.querySelectorAll('.modal-trigger');
if (DEBUG) logDebug('Found ' + triggers.length + ' modal triggers');
// Function to render embed blocks with dynamic delay
function renderEmbed(item, index, total) {
const container = document.getElementById(`embed-${item.id}`);
if (!container) {
if (DEBUG) logDebug(`Container not found for embed ID ${item.id}`, 'red');
return;
}
const divMatch = item.code.match(/<div\s+[^>]*id="[^"]+"[^>]*>/i);
const buttonMatch = item.code.match(/<script>\s*paypal\.Buttons\([\s\S]*?\)\.render\(['"][^'"]+['"]\);\s*<\/script>/i);
if (DEBUG) {
logDebug(`Div match for ID ${item.id}: ${divMatch ? 'Success' : 'Failed'}`, divMatch ? 'green' : 'red');
logDebug(`Button match for ID ${item.id}: ${buttonMatch ? 'Success' : 'Failed'}`, buttonMatch ? 'green' : 'red');
if (buttonMatch) logDebug(`Button script content for ID ${item.id}: ${buttonMatch[0]}`, 'orange');
}
if (item.type === 'PayPal' && divMatch && buttonMatch) {
const uniqueId = `paypal-button-container-${item.id}`;
let divContent = divMatch[0].replace(/id="[^"]+"/, `id="${uniqueId}"`);
container.innerHTML = divContent;
container.querySelector(`#${uniqueId}`).style.cssText = 'width: 100% !important; min-width: 300px !important; max-width: 300px !important; margin: 0 auto !important;';
if (DEBUG) logDebug(`Inserted div for PayPal ID ${item.id}`, 'orange');
function waitForSDK(callback) {
if (typeof paypal !== 'undefined') {
if (DEBUG) logDebug(`PayPal SDK available for ID ${item.id}`, 'green');
callback();
} else {
if (DEBUG) logDebug(`Checking SDK for ID ${item.id}, status: ${typeof paypal}`, 'yellow');
setTimeout(() => waitForSDK(callback), 100);
}
}
waitForSDK(() => {
let scriptContent = buttonMatch[0].replace(/^<script>|<\/script>$/g, '').trim();
scriptContent = scriptContent.replace(/\.render\(['"][^'"]+['"]\)/, `.render('#${uniqueId}')`);
const uniqueScript = `(function() { var paypalInstance = paypal.Buttons; ${scriptContent} })();`;
const buttonScript = document.createElement('script');
buttonScript.textContent = uniqueScript;
document.body.appendChild(buttonScript);
if (DEBUG) logDebug(`Injected unique button script for ID ${item.id}`, 'orange');
const dynamicDelay = index * 1500 + (total * 500);
setTimeout(() => {
const paypalButtons = document.querySelectorAll(`#${uniqueId} .paypal-buttons`);
const paypalIframes = document.querySelectorAll(`#${uniqueId} iframe`);
if (DEBUG) logDebug(`Found ${paypalButtons.length} button(s) and ${paypalIframes.length} iframe(s) for ID ${item.id} after ${dynamicDelay}ms`, paypalButtons.length > 0 ? 'green' : 'red');
paypalButtons.forEach((button, btnIndex) => {
const iframe = paypalIframes[btnIndex];
if (button && iframe) {
button.style.cssText += 'width: 100% !important; min-width: 300px !important; max-width: 300px !important; margin: 0 auto !important; border: none !important; outline: none !important; display: block !important;';
iframe.style.cssText += 'width: 100% !important; min-width: 300px !important; max-width: 300px !important; margin: 0 auto !important; border: none !important; outline: none !important; display: block !important;';
if (DEBUG) {
const style = window.getComputedStyle(button);
logDebug(`Computed style for button ${uniqueId} (index ${btnIndex}): width=${style.width}, margin=${style.margin}, justify-content=${style.justifyContent}`, 'purple');
}
} else if (DEBUG) {
logDebug(`Button or iframe not found for ID ${item.id} at index ${btnIndex}`, 'red');
}
});
}, dynamicDelay);
});
} else if (item.type === 'YouTube') {
container.innerHTML = item.code;
container.style.display = 'block';
if (DEBUG) logDebug(`Rendered YouTube embed for ID ${item.id}`, 'orange');
} else {
container.innerHTML = `<div class="embed-fallback" id="fallback-${item.id}">${item.code}</div>`;
container.style.display = 'block';
if (DEBUG) logDebug(`Fallback rendered for ID ${item.id} (parsing failed, scripts not executed)`, 'red');
}
}
if (window.contentCode && Array.isArray(window.contentCode)) {
window.contentCode.forEach((item, index) => {
renderEmbed(item, index, window.contentCode.length);
});
} else if (DEBUG) {
logDebug('contentCode is not an array or unavailable', 'red');
}
function adjustDesktopLayout() {
if (window.innerWidth >= 1024) {
const embedContainers = document.querySelectorAll('.main__right .section-hero--full .content-embed-container');
embedContainers.forEach(container => {
container.style.margin = '0 auto !important';
if (DEBUG) logDebug(`Adjusted desktop container centering for ${container.querySelector('.paypal-embed')?.id}`, 'blue');
});
}
}
window.addEventListener('load', adjustDesktopLayout);
window.addEventListener('resize', adjustDesktopLayout);
function openModal(content) {
const tempDiv = document.createElement('div');
tempDiv.innerHTML = content;
const backgroundWrappers = tempDiv.querySelectorAll('.background-image-wrapper');
backgroundWrappers.forEach(wrapper => wrapper.remove());
const buttons = tempDiv.querySelectorAll('.content__buttons');
buttons.forEach(button => button.remove());
const debugMessages = tempDiv.querySelectorAll('div[style*="color: purple"], div[style*="color: blue"], div[style*="color: red"], div[style*="color: green"]');
debugMessages.forEach(msg => msg.remove());
let combinedContent = '';
const sections = tempDiv.querySelectorAll('.modal-story-content');
if (DEBUG) logDebug('Found ' + sections.length + ' modal-story-content sections');
if (sections.length > 0) {
sections.forEach((section, index) => {
combinedContent += section.outerHTML.trim();
if (index < sections.length - 1) {
combinedContent += '<div class="modal-section-separator"></div>';
}
});
} else {
const fallbackSections = tempDiv.querySelectorAll('.section-hero__content');
if (DEBUG) logDebug('Found ' + fallbackSections.length + ' section-hero__content sections');
if (fallbackSections.length > 0) {
fallbackSections.forEach((section, index) => {
const title = section.querySelector('h1');
const image = section.querySelector('.content-image');
const content = section.querySelector('.generic-content');
const newContent = document.createElement('div');
newContent.className = 'modal-story-content';
if (title) newContent.appendChild(title.cloneNode(true));
if (image) newContent.appendChild(image.cloneNode(true));
if (content) newContent.appendChild(content.cloneNode(true));
combinedContent += newContent.outerHTML.trim();
if (index < fallbackSections.length - 1) {
combinedContent += '<div class="modal-section-separator"></div>';
}
});
} else {
const genericContent = tempDiv.querySelector('.generic-content');
if (genericContent) {
if (DEBUG) logDebug('Falling back to .generic-content');
const newContent = document.createElement('div');
newContent.className = 'modal-story-content';
newContent.appendChild(genericContent.cloneNode(true));
combinedContent = newContent.outerHTML.trim();
} else {
if (DEBUG) logDebug('No content found in .modal-story-content, .section-hero__content, or .generic-content', 'red');
combinedContent = '<p>Content could not be parsed from the page.</p>';
}
}
}
modalBody.innerHTML = combinedContent;
modal.style.display = 'block';
modal.setAttribute('aria-hidden', 'false');
if (modalBody.children.length > 0 && closeBtn) {
closeBtn.focus();
}
if (DEBUG) logDebug('Modal opened');
}
function closeModal() {
modal.style.display = 'none';
modal.setAttribute('aria-hidden', 'true');
modalBody.innerHTML = '';
if (DEBUG && debugLog) {
debugLog.innerHTML = '';
}
if (DEBUG) logDebug('Modal closed');
}
if (modal && modalBody && closeBtn && triggers) {
triggers.forEach(trigger => {
trigger.addEventListener('click', function(e) {
e.preventDefault();
const modalId = this.getAttribute('data-modal-id');
if (modalId) {
const contentDiv = document.getElementById(modalId);
if (contentDiv) {
const content = contentDiv.innerHTML;
if (DEBUG) logDebug('Stories modal triggered, content from ID: ' + modalId);
if (DEBUG) logDebug('Modal content length: ' + content.length + ' characters', 'purple');
openModal(content);
} else {
openModal('<p>Content not found.</p>');
if (DEBUG) logDebug('Modal content not found for ID: ' + modalId, 'red');
}
return;
}
const link = this.getAttribute('data-modal-link');
if (DEBUG) logDebug('Trigger clicked, link: ' + link);
if (!link || link === '#' || link.includes('index.php')) {
openModal('<p>This link cannot be loaded in a modal to prevent recursive loading.</p>');
return;
}
let basePath = window.location.origin;
let absoluteLink;
try {
if (link.startsWith('http://') || link.startsWith('https://')) {
absoluteLink = link;
} else if (link.startsWith('/')) {
absoluteLink = new URL(link, window.location.origin).href;
} else {
absoluteLink = new URL(link, window.location.origin + '/').href;
}
absoluteLink += (absoluteLink.includes('?') ? '&' : '?') + 'modal=1';
if (DEBUG) logDebug('Fetching absolute link: ' + absoluteLink);
} catch (error) {
if (DEBUG) logDebug('URL construction error: ' + error.message, 'red');
openModal('<p>Invalid URL format.</p>');
return;
}
openModal('<p>Loading...</p>');
fetch(absoluteLink, {
headers: {
'X-Requested-With': 'XMLHttpRequest'
}
})
.then(response => {
if (DEBUG) logDebug('Fetch response status: ' + response.status + ' ' + response.statusText);
if (!response.ok) {
throw new Error('Network response was not ok: ' + response.statusText);
}
return response.text();
})
.then(data => {
if (DEBUG) logDebug('Fetched HTML length: ' + data.length);
const parser = new DOMParser();
const doc = parser.parseFromString(data, 'text/html');
let combinedContent = '';
const sections = doc.querySelectorAll('.modal-story-content');
if (DEBUG) logDebug('Found ' + sections.length + ' modal-story-content sections in fetched content');
if (sections.length > 0) {
sections.forEach((content, index) => {
combinedContent += content.outerHTML.trim();
if (index < sections.length - 1) {
combinedContent += '<div class="modal-section-separator"></div>';
}
});
} else {
const fallbackSections = doc.querySelectorAll('.section-hero__content');
if (DEBUG) logDebug('Found ' + fallbackSections.length + ' section-hero__content sections');
if (fallbackSections.length > 0) {
fallbackSections.forEach((section, index) => {
const title = section.querySelector('h1');
const image = section.querySelector('.content-image');
const content = section.querySelector('.generic-content');
const newContent = document.createElement('div');
newContent.className = 'modal-story-content';
if (title) newContent.appendChild(title.cloneNode(true));
if (image) newContent.appendChild(image.cloneNode(true));
if (content) newContent.appendChild(content.cloneNode(true));
combinedContent += newContent.outerHTML.trim();
if (index < fallbackSections.length - 1) {
combinedContent += '<div class="modal-section-separator"></div>';
}
});
} else {
const genericContent = doc.querySelector('.generic-content');
if (genericContent) {
if (DEBUG) logDebug('Falling back to .generic-content');
const newContent = document.createElement('div');
newContent.className = 'modal-story-content';
newContent.appendChild(genericContent.cloneNode(true));
combinedContent = newContent.outerHTML.trim();
} else {
if (DEBUG) logDebug('No content found in .modal-story-content, .section-hero__content, or .generic-content', 'red');
combinedContent = '<p>Content could not be parsed from the page.</p>';
}
}
}
if (combinedContent) {
openModal(combinedContent);
} else {
openModal('<p>No content found.</p>');
}
})
.catch(error => {
if (DEBUG) logDebug('Fetch error: ' + error.message, 'red');
openModal('<p>Sorry, the content could not be loaded: ' + error.message + '</p>');
});
});
});
closeBtn.addEventListener('click', closeModal);
window.addEventListener('click', function(event) {
if (event.target === modal) {
closeModal();
}
});
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape' && modal.style.display === 'block') {
closeModal();
}
});
} else {
if (DEBUG) logDebug('Modal elements missing (modal, modalBody, closeBtn, or triggers)', 'red');
}
});
</script>
custom.css (Version 4.13)/* Custom CSS for Lifenavi (navi.claudioflute.live) and Chaplaincy Admin (admin.nlt-chaplaincy.org) - Version 4.13 */
/* Shared styles for both systems, with domain-specific overrides as noted */
/* Ensure myButton overrides theme styles */
.content__buttons a.myButton {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
a.myButtonBig {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Button Styles */
.myButtonBig {
background: linear-gradient(to bottom, #44c767 5%, #5cbf2a 100%);
background-color: #44c767;
border-radius: 28px;
border: 1px solid #18ab29;
display: inline-block;
cursor: pointer;
color: #ffffff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 21px;
font-weight: bold;
padding: 24px 42px;
text-decoration: none;
text-shadow: 0px 1px 0px #2f6627;
transition: all 0.3s ease;
}
.myButtonBig:hover {
background: linear-gradient(to bottom, #5cbf2a 5%, #44c767 100%);
background-color: #5cbf2a;
border-color: #137c21;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.myButtonBig:active {
position: relative;
top: 1px;
background: linear-gradient(to bottom, #3ba052 5%, #4aa62b 100%);
background-color: #3ba052;
border-color: #0f5c18;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
.myButton {
background: linear-gradient(to bottom, #44c767 5%, #5cbf2a 100%);
background-color: #44c767;
border-radius: 28px;
border: 1px solid #18ab29;
display: inline-block;
cursor: pointer;
color: #ffffff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 17px;
font-weight: bold;
padding: 16px 31px;
text-decoration: none;
text-shadow: 0px 1px 0px #2f6627;
transition: all 0.3s ease;
}
.myButton:hover {
background: linear-gradient(to bottom, #5cbf2a 5%, #44c767 100%);
background-color: #5cbf2a;
border-color: #137c21;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.myButton:active {
position: relative;
top: 1px;
background: linear-gradient(to bottom, #3ba052 5%, #4aa62b 100%);
background-color: #3ba052;
border-color: #0f5c18;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
/* Set default font for the entire site */
body {
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Test class to verify font loading */
.font-test {
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 24px;
color: red;
}
/* Dynamic Section Styles */
.content__entry {
position: relative;
padding: 20px;
min-height: 200px;
margin: 0 auto;
max-width: 1200px;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-color: #fff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Hide empty content__entry div from Publii theme */
div.content__entry:empty {
display: none;
}
/* Alternative: Hide content__entry div on dynamic pages (uncomment and add data-page-type="dynamic" to <body> if needed) */
/* body[data-page-type="dynamic"] div.content__entry {
display: none;
} */
.section-hero--full {
width: auto;
position: relative;
left: 0;
transform: none;
margin: 0 auto;
max-width: 1200px;
min-height: 0; /* Remove fixed height to adapt to content */
background-color: #fff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
overflow: visible; /* Prevent clipping */
}
.section-hero--column {
flex: 1;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
padding: 10px;
}
.section-group {
display: flex;
flex-wrap: nowrap; /* Prevent wrapping to new rows */
gap: 20px;
max-width: 1200px;
margin: 0 auto;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.layout-2-column {
display: flex;
justify-content: space-between;
}
.layout-2-column .section-hero--column {
flex: 1 0 49%; /* Slightly less than 50% to account for gap */
max-width: 49%;
}
.layout-3-column {
display: flex;
justify-content: space-between;
}
.layout-3-column .section-hero--column {
flex: 1 0 32%; /* Slightly less than 33.33% to account for gap */
max-width: 32%;
}
/* Layout and Button Styling (Moved from pull-contents.php) */
@media (min-width: 768px) {
.section-hero--full.layout-2-column .section-hero__content {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
}
.section-hero--full.layout-3-column .section-hero__content {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 20px;
}
.column {
width: 100%; /* Ensure columns take full width in grid */
position: relative; /* Provide containing block for absolute positioning */
min-height: 0; /* Adapt to content height */
}
.content-embed {
width: 300px; /* Fixed width for uniformity */
margin: 0 auto; /* Center the embed container */
text-align: center; /* Center the button within */
}
.paypal-button {
width: 300px !important; /* Fixed width for all buttons */
max-width: 300px !important; /* Prevent overflow or shrinkage */
box-sizing: border-box; /* Include padding in width */
margin: 0 auto; /* Center the button */
}
.background-image-wrapper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%; /* Use 100% of parent height */
background-size: cover;
background-position: center;
z-index: -1; /* Behind content */
}
}
@media (max-width: 767px) {
.section-hero--full .section-hero__content {
display: block; /* Stack vertically on mobile */
}
.column {
margin-bottom: 20px; /* Add spacing between stacked sections */
width: 100%; /* Ensure full width on mobile */
position: relative; /* Provide containing block for absolute positioning */
min-height: 0; /* Adapt to content height */
}
.content-embed {
width: 100% !important; /* Force full width on mobile, overriding SDK styles */
}
.paypal-button {
width: 100% !important; /* Force PayPal button to full width on mobile */
max-width: none !important; /* Remove any max-width constraints */
}
.content__buttons {
text-align: center !important; /* Center align buttons on mobile */
}
.background-image-wrapper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%; /* Use 100% of parent height */
background-size: cover;
background-position: center;
z-index: -1; /* Behind content */
}
}
/* Alignment Classes */
.align-left {
text-align: left;
}
.content-image.align-left, .video-embed.align-left {
margin: 1em 0;
}
.align-center {
text-align: center;
}
/* Override theme's heading font variable */
h1, h2, h3, h4, h5, h6 {
font-family: "LXGW WenKai TC", "Times New Roman", serif !important;
margin-bottom: 1.5em !important;
}
/* Ensure specific heading styles inherit the font */
.content__entry h1 {
font-size: 2em;
font-weight: 700;
line-height: 1.2;
color: #333;
margin-bottom: 1.5em !important;
padding-top: 1em;
text-align: center;
text-shadow: none;
font-family: "LXGW WenKai TC", "Times New Roman", serif !important;
}
.generic-content {
margin: 0 auto;
max-width: 800px;
font-size: 1em;
line-height: 1.6;
color: #333;
margin-bottom: 1em;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.content__entry[style*="background-image"] h1,
.content__entry[style*="background-image"] .generic-content {
color: #fff;
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}
.generic-content p {
margin: 0 0 1em 0;
}
.generic-content ul,
.generic-content ol {
margin: 0 0 1em 0;
padding: 0 !important;
list-style: none !important;
}
.generic-content li {
margin-bottom: 0.5em;
text-align: inherit;
list-style: none !important;
}
.generic-content ul[style*="list-style"],
.generic-content ol[style*="list-style"],
.generic-content li[style*="list-style"] {
list-style: none !important;
}
.content__buttons {
text-align: center !important; /* Default center alignment */
margin: 2em 0 1em 0;
}
.content__buttons a.myButton {
display: inline-block;
margin: 0 auto;
}
.content__entry .content__buttons {
text-align: center !important;
}
/* Remove white space for title-text model when no image */
.column[model="title-text"]:not(:has(.content-image)) {
min-height: 0 !important;
padding-bottom: 0 !important;
}
/* Adjust for title-text model without image */
.column[model="title-text"]:not(:has(.content-image)) .generic-content {
margin-bottom: 0 !important;
}
.welcome-image {
max-width: 100%;
height: auto;
margin: 1em auto;
display: block;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.video-embed {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
margin: 1em auto;
max-width: 800px;
background: none;
}
.video-embed iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
}
.separator {
text-align: center;
margin: 60px 0 20px 0;
}
.content__entry.content__entry--full:first-child {
min-height: 0 !important;
padding-top: 0 !important;
margin-top: 0 !important;
}
.main.page .main__right:first-child {
margin-top: -3.8rem !important;
}
.main.page .main__right {
margin: 0% !important;
}
.banner--after-content {
margin: 0 !important;
padding: 0 !important;
border: none !important;
outline: none !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
@media (max-width: 768px) {
.main.page .main__right:first-child {
margin-top: 0 !important;
margin-bottom: 0 !important;
}
.main.page .container:first-child,
.main.page .post__entry:first-child {
margin: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.main.page .main__right .main__right--bottom:first-child {
margin-top: -3.8rem !important;
margin-bottom: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.main.page .container > .main__right > .main__right--bottom:first-child,
.main.page .post__entry > .main__right > .main__right--bottom:first-child {
margin: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.banner--after-content {
margin: 0 !important;
padding: 0 !important;
border: none !important;
outline: none !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
}
@media (min-width: 769px) and (max-width: 1023px) {
.main.page .main__right {
margin: 0 auto !important;
max-width: 90% !important;
width: auto !important;
}
.main.page .main__right .content__entry--full {
margin: 0 auto !important;
max-width: 100% !important;
}
.main.page .main__right .main__right--bottom {
margin: 0 auto !important;
max-width: 100% !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
}
.main.page .main__right .main__right--bottom .section-hero--full:first-child {
margin-top: 0 !important;
padding-top: 0 !important;
}
.content__entry.content__entry--full .separator:first-child {
margin-top: 0;
}
.section-hero--full:not([style*="background-image"]) + .separator {
margin-top: 40px;
}
.separator-image {
max-width: 100%;
height: auto;
display: block;
margin: 0 auto;
}
.separator img[src$="down_arrow.png"] {
max-width: 256px;
}
hr {
display: none !important;
visibility: hidden !important;
}
.post__content hr,
.container hr,
.post__content hr[style],
.container hr[style] {
display: none !important;
visibility: hidden !important;
}
.post__content::before,
.post__content::after,
.container::before,
.container::after,
.post__entry::before,
.post__entry::after,
.content__entry::before,
.content__entry::after,
.generic-content::before,
.generic-content::after {
display: none !important;
border: none !important;
content: none !important;
}
.separator::before,
.separator::after {
display: none !important;
border: none !important;
content: none !important;
}
body,
body p,
body h2,
body h3,
body h4,
body h5,
body h6,
.post__content,
.post__content p,
.post__content h2,
.post__content h3,
.post__content h4,
.post__content h5,
.post__content h6,
.container,
.container p,
.container h2,
.container h3,
.container h4,
.container h5,
.container h6 {
color: #333 !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
h1.post__title,
h1.hero__title,
h1.site__title {
color: #fff !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
a.button,
a.btn,
a.post__button,
.post__content a.button,
.post__content a.btn,
.post__content a.post__button,
.container a.button,
.container a.btn,
.container a.post__button {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Custom Modal Styles */
.modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.5);
}
.modal-content {
background-color: #fff;
margin: 5% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 800px;
min-height: 200px;
position: relative;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
box-sizing: border-box;
}
.modal-close {
color: #aaa;
position: absolute;
top: 10px;
right: 20px;
font-size: 28px;
font-weight: bold;
cursor: pointer;
transition: color 0.3s ease;
z-index: 1001;
}
.modal-close:hover,
.modal-close:focus {
color: #000;
text-decoration: none;
}
#modal-body {
font-size: 1em;
line-height: 1.6;
color: #333;
max-width: 100%;
box-sizing: border-box;
padding-top: 40px;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
overflow-x: hidden;
}
#modal-body h1 {
font-size: 1.5em;
margin-bottom: 0.5em;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
#modal-body p {
margin-bottom: 1em;
}
#modal-body * {
max-width: 100%;
height: auto;
box-sizing: border-box;
}
#modal-body img,
#modal-body div,
#modal-body table {
max-width: 100%;
height: auto;
}
#modal-body .welcome-image {
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.modal[aria-hidden="false"] {
display: block;
}
.modal-close:focus {
outline: 2px solid #44c767;
outline-offset: 2px;
}
/* Custom separator for modal sections */
.modal-section-separator {
text-align: center;
margin: 20px 0;
font-size: 24px;
line-height: 1;
color: #666;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.modal-section-separator::before {
content: "···";
}
/* Modal-specific content container */
.modal-story-content {
max-width: 100%;
margin: 0 auto;
padding: 20px;
box-sizing: border-box;
overflow-x: hidden;
}
.modal-story-content h1 {
font-size: 2rem;
margin-bottom: 1rem;
text-align: center;
}
.modal-story-content .content-image {
max-width: 100%;
margin: 1rem 0;
}
.modal-story-content .generic-content {
font-size: 1rem;
line-height: 1.6;
}
/* Hide background image in modal */
.modal .background-image-wrapper {
display: none !important;
}
/* Chaplaincy Admin specific overrides */
.report-container {
max-width: 100% !important;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.content__entry {
max-width: 100% !important;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
box-sizing: border-box !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.content__entry table.report-table {
width: 100% !important;
margin: 0 !important;
padding: 0 !important;
border-collapse: collapse !important;
box-sizing: border-box !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Fix background image rendering */
.section-hero--full .section-hero__content,
.section-hero--full .column {
position: relative; /* Containing block for absolute positioning */
min-height: 0; /* Adapt to content height */
}
.section-hero--full .background-image-wrapper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%; /* Use 100% of parent height */
background-size: cover;
background-position: center;
z-index: -1; /* Behind content */
}
/* Add to custom.css or a Chaplaincy-specific file */
html, body {
overflow-x: hidden;
width: 100%;
margin: 0;
padding: 0;
}
.main.page, .container, .post__entry {
width: 100%;
max-width: 100%;
overflow-x: hidden;
}
/* PP Button Layout Adjustments */
@media (min-width: 769px) {
.layout-3-column.position-100 .section-hero--column {
flex: 1 0 32%;
max-width: 32%;
}
}
@media (max-width: 768px) {
.layout-3-column.position-100 .section-hero--column {
flex: 1 0 100%;
max-width: 100%;
}
}
.section-group.position-100,
.section-hero--full {
margin-top: 2em;
}
/* Remove shadow from section images */
.content-image img,
.welcome-image {
box-shadow: none !important;
-webkit-box-shadow: none !important; /* For Safari compatibility */
-moz-box-shadow: none !important; /* For Firefox compatibility */
}
/* Ensure no border or other effects interfere */
.content-image,
.modal-image {
box-shadow: none !important;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
}
Version Updates:
pull-contents.php from 2.65 to 2.66.custom.css from 4.12 to 4.13.Background Image Fix:
transform: translateX(-50%) from the PayPal .content-embed-container inline style to prevent layout disruption.min-height: 0 on .section-hero--full, .column, and .section-hero__content to let the height adapt to content, aligning with the earlier working state.White Space Fix for "title-text" Model:
.column[model="title-text"]:not(:has(.content-image)) to collapse min-height and padding-bottom when no image is present..column[model="title-text"]:not(:has(.content-image)) .generic-content to remove margin-bottom for tighter layout.Update Files:
pull-contents.php with the updated Version 2.66.custom.css with the updated Version 4.13 (located in your Publii theme folder, e.g., input/themes/your-theme/assets/css/custom.css).Test Background Image:
https://www.nlt-chaplaincy.org/index.html) with a section where theme_img is set as "Background".https://admin.nlt-chaplaincy.org/images/d1f4e762f2eabf1d4.jpg) appears behind the section title and content.Debug: Background image set to: [URL] | Wrapper height: [value]px and inspect the .background-image-wrapper computed styles (e.g., height, visibility).Test "title-text" White Space:
.column element to ensure min-height: 0 and no residual padding.Test Modal Behavior:
Inspect Elements:
.background-image-wrapper:
height: 100% matches the parent .column height.display: none or overflow issues..generic-content.Adjustments:
Please update to Version 2.66 and Version 4.13, test, and let me know the results!
With this fix, the red box for section 6 has become purple, with the same layering. For section 4, the image is finally shown behind title, text and image. Inconsistency between S4 and 6 is still there (What's expected is another purple box for S4). Currently, the background image of S4 and the purple box of S6 are NOT taking up the entire width of the content frame, but according to our early requirements background images should fill up the entire section frame, instead of leaving white spaces at the left/right edges and cut off at the bottom of the action button as it is now. The floating message is:
Debug: Found 2 background-image-wrapper elements Debug: Adjusted background wrapper height for parent column column-0: 284.13751220703125px, computed height: 284.138px Debug: Computed styles for wrapper: opacity=1, visibility=visible, display=block, z-index=-1 Debug: Content after wrapper: Yes Debug: Adjusted background wrapper height for parent column column-0: 733.1875px, computed height: 733.188px Debug: Computed styles for wrapper: opacity=1, visibility=visible, display=block, z-index=-1 Debug: Content after wrapper: Yes
With further investigation, I think the cause for section inconsistency is because S6 is using a pattern with transparent background while S4 is using a normal image. It's not caused by coding and styling. If so, do we need to update V4.19 and 2.71? Note that we still need to handle the "background image doesn't take up the full section space" issue.
This doesn't make the background image any wider or extending beyond the bottom of the action button (Expected to). It looks like that the entire content frame (Something like main_right in the CSS class) has white borders on both the left and the right. Only the hero image in the top banner area ("main_left") is taking the full width of the page (Mobile view) or frame (Desktop view). As a reminder, please make sure fixing background image display won't touch or affect the multi-column thing.
While this fix does extend the background image (Bravo!), the image is overflowing onto the left frame on desktop view. On both desktop and mobile views, the bottom of the background image is covering the top of the default divider image. You may look at the attached screenshot for the circled and underlined areas.
This fix doesn't help! Btw, why we have to update both the CSS and the PHP in pairs in these rounds of fixes? I recall that when a background image is present, the title and text should auto-change to white. I wonder if this logic is still present as I see no change in the text color. I think we can re-evaluate this feature anyway, as the color of the background image can affect the best font color to use. You can review previous chats for rationale as I can't remember it clearly.
The overflow issue comes back again with this fix. I wonder if the browser knows how wide to show the main_right frame it should be straight forward to just pass the same width to the background image.
width: 100vw approach with overflow-x: hidden on .section-hero--full-wrapper isn’t consistently clipping the excess, likely due to the absolute positioning of .background-image-wrapper escaping the wrapper’s overflow context or a mismatch in how the browser calculates the .main__right frame’s width. Your suggestion to align the background image width with .main__right is a solid one, as it avoids viewport-based overflow and directly matches the content frame. Let’s implement this by dynamically setting the background wrapper’s width to match .main__right’s width, leveraging the script to calculate it at runtime.100vw width extends beyond the .main__right frame, and overflow-x: hidden on .section-hero--full-wrapper might not apply correctly if the wrapper isn’t the immediate parent or if the theme’s layout (e.g., Publii’s .main.page or .container) overrides it..main__right’s width avoids overflow by tying it to the actual content frame, which should be straightforward if we can access its dimensions dynamically..main__right’s width and apply it to .background-image-wrapper, ensuring it extends fully within the frame without spilling over..background-image-wrapper’s width to .main__right’s width, centered within .section-hero--full-wrapper..section-hero--full-wrapper’s overflow-x: hidden as a safeguard.custom.css (Version 4.27)/* Custom CSS for Lifenavi (navi.claudioflute.live) and Chaplaincy Admin (admin.nlt-chaplaincy.org) - Version 4.27 */
/* Shared styles for both systems, with domain-specific overrides as noted */
/* Ensure myButton overrides theme styles */
.content__buttons a.myButton {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
a.myButtonBig {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Button Styles */
.myButtonBig {
background: linear-gradient(to bottom, #44c767 5%, #5cbf2a 100%);
background-color: #44c767;
border-radius: 28px;
border: 1px solid #18ab29;
display: inline-block;
cursor: pointer;
color: #ffffff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 21px;
font-weight: bold;
padding: 24px 42px;
text-decoration: none;
text-shadow: 0px 1px 0px #2f6627;
transition: all 0.3s ease;
}
.myButtonBig:hover {
background: linear-gradient(to bottom, #5cbf2a 5%, #44c767 100%);
background-color: #5cbf2a;
border-color: #137c21;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.myButtonBig:active {
position: relative;
top: 1px;
background: linear-gradient(to bottom, #3ba052 5%, #4aa62b 100%);
background-color: #3ba052;
border-color: #0f5c18;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
.myButton {
background: linear-gradient(to bottom, #44c767 5%, #5cbf2a 100%);
background-color: #44c767;
border-radius: 28px;
border: 1px solid #18ab29;
display: inline-block;
cursor: pointer;
color: #ffffff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 17px;
font-weight: bold;
padding: 16px 31px;
text-decoration: none;
text-shadow: 0px 1px 0px #2f6627;
transition: all 0.3s ease;
}
.myButton:hover {
background: linear-gradient(to bottom, #5cbf2a 5%, #44c767 100%);
background-color: #5cbf2a;
border-color: #137c21;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.myButton:active {
position: relative;
top: 1px;
background: linear-gradient(to bottom, #3ba052 5%, #4aa62b 100%);
background-color: #3ba052;
border-color: #0f5c18;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
/* Set default font for the entire site */
body {
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Test class to verify font loading */
.font-test {
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 24px;
color: red;
}
/* Dynamic Section Styles */
.content__entry {
position: relative;
padding: 20px;
min-height: 200px;
margin: 0 auto;
max-width: 1200px;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-color: #fff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Hide empty content__entry div from Publii theme */
div.content__entry:empty {
display: none;
}
/* Alternative: Hide content__entry div on dynamic pages (uncomment and add data-page-type="dynamic" to <body> if needed) */
/* body[data-page-type="dynamic"] div.content__entry {
display: none;
} */
.section-hero--full-wrapper {
overflow-x: hidden; /* Contain overflow */
width: 100%;
max-width: 1200px;
margin: 0 auto;
position: relative; /* Ensure proper context */
}
.section-hero--full {
width: 100%; /* Ensure full width of container */
position: relative;
left: 0;
transform: none;
margin: 0 auto;
min-height: 0; /* Adapt to content height */
background-color: #fff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
overflow: visible; /* Prevent clipping */
padding: 0; /* Remove padding to allow full width */
}
.section-hero--column {
flex: 1;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
padding: 10px;
}
.section-group {
display: flex;
flex-wrap: nowrap; /* Prevent wrapping to new rows */
gap: 20px;
max-width: 1200px;
margin: 0 auto;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.layout-2-column {
display: flex;
justify-content: space-between;
}
.layout-2-column .section-hero--column {
flex: 1 0 49%; /* Slightly less than 50% to account for gap */
max-width: 49%;
}
.layout-3-column {
display: flex;
justify-content: space-between;
}
.layout-3-column .section-hero--column {
flex: 1 0 32%; /* Slightly less than 33.33% to account for gap */
max-width: 32%;
}
/* Layout and Button Styling (Moved from pull-contents.php) */
@media (min-width: 768px) {
.section-hero--full.layout-2-column .section-hero__content {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
}
.section-hero--full.layout-3-column .section-hero__content {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 20px;
}
.column {
width: 100%; /* Ensure columns take full width in grid */
position: relative; /* Provide containing block for absolute positioning */
min-height: 200px; /* Fallback minimum height */
overflow: visible; /* Prevent clipping of absolute child */
z-index: 0; /* Ensure content stays above background */
}
.content-embed {
width: 300px; /* Fixed width for uniformity */
margin: 0 auto; /* Center the embed container */
text-align: center; /* Center the button within */
}
.paypal-button {
width: 300px !important; /* Fixed width for all buttons */
max-width: 300px !important; /* Prevent overflow or shrinkage */
box-sizing: border-box; /* Include padding in width */
margin: 0 auto; /* Center the button */
}
.background-image-wrapper {
position: absolute;
top: 0;
left: 50%; /* Center align with transform */
height: 100%; /* Use 100% of parent height */
background-size: cover;
background-position: center;
z-index: -1; /* Place behind content */
opacity: 1 !important; /* Force visibility */
visibility: visible !important; /* Ensure not hidden */
background-repeat: no-repeat !important; /* Prevent repeat issues */
background-color: rgba(0, 0, 255, 0.3); /* Blue tint as fallback */
transform: translateX(-50%); /* Adjust to center based on viewport */
}
.section-hero--full {
padding: 0; /* Remove padding to allow full width */
position: relative; /* Context for absolute positioning */
}
.section-hero__content {
position: relative;
width: 100%; /* Ensure full width */
min-height: 100%; /* Match section height */
box-sizing: border-box; /* Include padding in height */
}
.column {
padding: 0; /* Remove column padding to allow wrapper to fill */
box-sizing: border-box;
}
}
@media (max-width: 767px) {
.section-hero--full .section-hero__content {
display: block; /* Stack vertically on mobile */
}
.column {
margin-bottom: 20px; /* Add spacing between stacked sections */
width: 100%; /* Ensure full width on mobile */
position: relative; /* Provide containing block for absolute positioning */
min-height: 200px; /* Fallback minimum height */
overflow: visible; /* Prevent clipping of absolute child */
z-index: 0; /* Ensure content stays above background */
}
.content-embed {
width: 100% !important; /* Force full width on mobile, overriding SDK styles */
}
.paypal-button {
width: 100% !important; /* Force PayPal button to full width on mobile */
max-width: none !important; /* Remove any max-width constraints */
}
.content__buttons {
text-align: center !important; /* Center align buttons on mobile */
}
.background-image-wrapper {
position: absolute;
top: 0;
left: 50%; /* Center align with transform */
height: 100%; /* Use 100% of parent height */
background-size: cover;
background-position: center;
z-index: -1; /* Place behind content */
opacity: 1 !important; /* Force visibility */
visibility: visible !important; /* Ensure not hidden */
background-repeat: no-repeat !important; /* Prevent repeat issues */
background-color: rgba(0, 0, 255, 0.3); /* Blue tint as fallback */
transform: translateX(-50%); /* Adjust to center based on viewport */
}
.section-hero--full {
padding: 0; /* Remove padding to allow full width */
position: relative; /* Context for absolute positioning */
}
.section-hero__content {
position: relative;
width: 100%; /* Ensure full width */
min-height: 100%; /* Match section height */
box-sizing: border-box; /* Include padding in height */
}
.column {
padding: 0; /* Remove column padding to allow wrapper to fill */
box-sizing: border-box;
}
}
/* Alignment Classes */
.align-left {
text-align: left;
}
.content-image.align-left, .video-embed.align-left {
margin: 1em 0;
}
.align-center {
text-align: center;
}
/* Override theme's heading font variable */
h1, h2, h3, h4, h5, h6 {
font-family: "LXGW WenKai TC", "Times New Roman", serif !important;
margin-bottom: 1.5em !important;
}
/* Ensure specific heading styles inherit the font */
.content__entry h1 {
font-size: 2em;
font-weight: 700;
line-height: 1.2;
color: #333;
margin-bottom: 1.5em !important;
padding-top: 1em;
text-align: center;
text-shadow: none;
font-family: "LXGW WenKai TC", "Times New Roman", serif !important;
}
.generic-content {
margin: 0 auto;
max-width: 800px;
font-size: 1em;
line-height: 1.6;
color: #333;
margin-bottom: 1em;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.content__entry[style*="background-image"] h1,
.content__entry[style*="background-image"] .generic-content {
color: #fff !important; /* Auto-switch to white with background image */
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}
/* Optional manual override for font color */
.content__entry[data-font-color="custom"] h1,
.content__entry[data-font-color="custom"] .generic-content {
color: var(--custom-font-color, #333) !important;
}
.generic-content p {
margin: 0 0 1em 0;
}
.generic-content ul,
.generic-content ol {
margin: 0 0 1em 0;
padding: 0 !important;
list-style: none !important;
}
.generic-content li {
margin-bottom: 0.5em;
text-align: inherit;
list-style: none !important;
}
.generic-content ul[style*="list-style"],
.generic-content ol[style*="list-style"],
.generic-content li[style*="list-style"] {
list-style: none !important;
}
.content__buttons {
text-align: center !important; /* Default center alignment */
margin: 2em 0 1em 0;
position: relative; /* Ensure it’s part of the flow */
z-index: 1; /* Keep above background */
}
.content__buttons a.myButton {
display: inline-block;
margin: 0 auto;
}
.content__entry .content__buttons {
text-align: center !important;
}
/* Remove white space for title-text model when no image */
.column[data-model="title-text"]:not(:has(.content-image)) {
min-height: 0 !important;
padding-bottom: 0 !important;
}
/* Adjust for title-text model without image */
.column[data-model="title-text"]:not(:has(.content-image)) .generic-content {
margin-bottom: 0 !important;
}
.welcome-image {
max-width: 100%;
height: auto;
margin: 1em auto;
display: block;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.video-embed {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
margin: 1em auto;
max-width: 800px;
background: none;
}
.video-embed iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
}
.separator {
text-align: center;
margin: 60px 0 20px 0;
}
.content__entry.content__entry--full:first-child {
min-height: 0 !important;
padding-top: 0 !important;
margin-top: 0 !important;
}
.main.page .main__right:first-child {
margin-top: -3.8rem !important;
}
.main.page .main__right {
margin: 0% !important;
}
.banner--after-content {
margin: 0 !important;
padding: 0 !important;
border: none !important;
outline: none !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
@media (max-width: 768px) {
.main.page .main__right:first-child {
margin-top: 0 !important;
margin-bottom: 0 !important;
}
.main.page .container:first-child,
.main.page .post__entry:first-child {
margin: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.main.page .main__right .main__right--bottom:first-child {
margin-top: -3.8rem !important;
margin-bottom: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.main.page .container > .main__right > .main__right--bottom:first-child,
.main.page .post__entry > .main__right > .main__right--bottom:first-child {
margin: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.banner--after-content {
margin: 0 !important;
padding: 0 !important;
border: none !important;
outline: none !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
}
@media (min-width: 769px) and (max-width: 1023px) {
.main.page .main__right {
margin: 0 auto !important;
max-width: 90% !important;
width: auto !important;
}
.main.page .main__right .content__entry--full {
margin: 0 auto !important;
max-width: 100% !important;
}
.main.page .main__right .main__right--bottom {
margin: 0 auto !important;
max-width: 100% !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
}
.main.page .main__right .main__right--bottom .section-hero--full:first-child {
margin-top: 0 !important;
padding-top: 0 !important;
}
.content__entry.content__entry--full .separator:first-child {
margin-top: 0;
}
.section-hero--full:not([style*="background-image"]) + .separator {
margin-top: 40px;
}
.separator-image {
max-width: 100%;
height: auto;
display: block;
margin: 0 auto;
}
.separator img[src$="down_arrow.png"] {
max-width: 256px;
}
hr {
display: none !important;
visibility: hidden !important;
}
.post__content hr,
.container hr,
.post__content hr[style],
.container hr[style] {
display: none !important;
visibility: hidden !important;
}
.post__content::before,
.post__content::after,
.container::before,
.container::after,
.post__entry::before,
.post__entry::after,
.content__entry::before,
.content__entry::after,
.generic-content::before,
.generic-content::after {
display: none !important;
border: none !important;
content: none !important;
}
.separator::before,
.separator::after {
display: none !important;
border: none !important;
content: none !important;
}
body,
body p,
body h2,
body h3,
body h4,
body h5,
body h6,
.post__content,
.post__content p,
.post__content h2,
.post__content h3,
.post__content h4,
.post__content h5,
.post__content h6,
.container,
.container p,
.container h2,
.container h3,
.container h4,
.container h5,
.container h6 {
color: #333 !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
h1.post__title,
h1.hero__title,
h1.site__title {
color: #fff !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
a.button,
a.btn,
a.post__button,
.post__content a.button,
.post__content a.btn,
.post__content a.post__button,
.container a.button,
.container a.btn,
.container a.post__button {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Custom Modal Styles */
.modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.5);
}
.modal-content {
background-color: #fff;
margin: 5% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 800px;
min-height: 200px;
position: relative;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
box-sizing: border-box;
}
.modal-close {
color: #aaa;
position: absolute;
top: 10px;
right: 20px;
font-size: 28px;
font-weight: bold;
cursor: pointer;
transition: color 0.3s ease;
z-index: 1001;
}
.modal-close:hover,
.modal-close:focus {
color: #000;
text-decoration: none;
}
#modal-body {
font-size: 1em;
line-height: 1.6;
color: #333;
max-width: 100%;
box-sizing: border-box;
padding-top: 40px;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
overflow-x: hidden;
}
#modal-body h1 {
font-size: 1.5em;
margin-bottom: 0.5em;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
#modal-body p {
margin-bottom: 1em;
}
#modal-body * {
max-width: 100%;
height: auto;
box-sizing: border-box;
}
#modal-body img,
#modal-body div,
#modal-body table {
max-width: 100%;
height: auto;
}
#modal-body .welcome-image {
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.modal[aria-hidden="false"] {
display: block;
}
.modal-close:focus {
outline: 2px solid #44c767;
outline-offset: 2px;
}
/* Custom separator for modal sections */
.modal-section-separator {
text-align: center;
margin: 20px 0;
font-size: 24px;
line-height: 1;
color: #666;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.modal-section-separator::before {
content: "···";
}
/* Modal-specific content container */
.modal-story-content {
max-width: 100%;
margin: 0 auto;
padding: 20px;
box-sizing: border-box;
overflow-x: hidden;
}
.modal-story-content h1 {
font-size: 2rem;
margin-bottom: 1rem;
text-align: center;
}
.modal-story-content .content-image {
max-width: 100%;
margin: 1rem 0;
}
.modal-story-content .generic-content {
font-size: 1rem;
line-height: 1.6;
}
/* Hide background image in modal */
.modal .background-image-wrapper {
display: none !important;
}
/* Chaplaincy Admin specific overrides */
.report-container {
max-width: 100% !important;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.content__entry {
max-width: 100% !important;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
box-sizing: border-box !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.content__entry table.report-table {
width: 100% !important;
margin: 0 !important;
padding: 0 !important;
border-collapse: collapse !important;
box-sizing: border-box !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Fix background image rendering */
.section-hero--full .section-hero__content,
.section-hero--full .column {
position: relative; /* Containing block for absolute positioning */
min-height: 200px; /* Fallback minimum height */
overflow: visible; /* Prevent clipping of absolute child */
width: 100%; /* Ensure full width */
box-sizing: border-box; /* Include padding in dimensions */
}
.section-hero--full .background-image-wrapper {
position: absolute;
top: 0;
left: 50%; /* Center align with transform */
height: 100%; /* Use 100% of parent height */
background-size: cover;
background-position: center;
z-index: -1; /* Place behind content */
opacity: 1 !important; /* Force visibility */
visibility: visible !important; /* Ensure not hidden */
background-repeat: no-repeat !important; /* Prevent repeat issues */
background-color: rgba(0, 0, 255, 0.3); /* Blue tint as fallback */
transform: translateX(-50%); /* Adjust to center based on viewport */
}
/* Add to custom.css or a Chaplaincy-specific file */
html, body {
overflow-x: hidden;
width: 100%;
margin: 0;
padding: 0;
}
.main.page, .container, .post__entry {
width: 100%;
max-width: 100%;
overflow-x: hidden;
}
/* PP Button Layout Adjustments */
@media (min-width: 769px) {
.layout-3-column.position-100 .section-hero--column {
flex: 1 0 32%;
max-width: 32%;
}
}
@media (max-width: 768px) {
.layout-3-column.position-100 .section-hero--column {
flex: 1 0 100%;
max-width: 100%;
}
}
.section-group.position-100,
.section-hero--full {
margin-top: 2em;
}
/* Remove shadow from section images */
.content-image img,
.welcome-image {
box-shadow: none !important;
-webkit-box-shadow: none !important; /* For Safari compatibility */
-moz-box-shadow: none !important; /* For Firefox compatibility */
}
/* Ensure no border or other effects interfere */
.content-image,
.modal-image {
box-shadow: none !important;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
}
pull-contents.php (Version 2.79)(Only the script section is updated for brevity; the rest remains as in 2.78)
<script>
document.addEventListener('DOMContentLoaded', function() {
// Synchronize with PHP DEBUG setting
const DEBUG = <?php echo DEBUG ? 'true' : 'false'; ?>;
// Debug log setup
let debugLog = null;
if (DEBUG) {
debugLog = document.createElement('div');
debugLog.id = 'debug-log';
debugLog.style.position = 'fixed';
debugLog.style.bottom = '10px';
debugLog.style.left = '10px';
debugLog.style.background = 'rgba(0, 0, 0, 0.8)';
debugLog.style.color = 'white';
debugLog.style.padding = '10px';
debugLog.style.zIndex = '1000';
debugLog.style.maxHeight = '200px';
debugLog.style.overflowY = 'auto';
document.body.appendChild(debugLog);
}
function logDebug(message, color = 'green') {
if (DEBUG && debugLog) {
debugLog.insertAdjacentHTML('beforeend', `<div style="color: ${color}; font-weight: bold;">Debug: ${message}</div>`);
debugLog.scrollTop = debugLog.scrollHeight;
}
if (DEBUG && console) console.log(`Debug: ${message}`, { color });
}
// Adjust background wrapper width and height with delayed execution and style logging
function adjustBackground() {
setTimeout(() => {
const mainRight = document.querySelector('.main__right');
if (mainRight) {
const mainRightWidth = mainRight.getBoundingClientRect().width;
const wrappers = document.querySelectorAll('.background-image-wrapper');
if (DEBUG) logDebug(`Found ${wrappers.length} background-image-wrapper elements, main__right width: ${mainRightWidth}px`, wrappers.length > 0 ? 'green' : 'red');
wrappers.forEach(wrapper => {
const parent = wrapper.closest('.column');
const section = parent.closest('.section-hero--full');
if (section) {
wrapper.style.width = `${mainRightWidth}px`; // Match main__right width
const sectionHeight = section.getBoundingClientRect().height;
const button = section.querySelector('.content__buttons');
const buttonHeight = button ? button.getBoundingClientRect().height : 0;
const totalHeight = sectionHeight + buttonHeight; // Include button height
const separator = section.nextElementSibling;
const sepTop = separator && separator.classList.contains('separator') ? separator.getBoundingClientRect().top : Infinity;
const adjustedHeight = Math.min(totalHeight, sepTop - section.getBoundingClientRect().top - 10); // Subtract 10px buffer
if (adjustedHeight > 0) {
wrapper.style.height = `${adjustedHeight}px`;
const computedStyle = window.getComputedStyle(wrapper);
const bgImage = computedStyle.backgroundImage;
const nextSibling = wrapper.nextSibling;
const hasContentAfter = nextSibling && (nextSibling.nodeType === 1 || nextSibling.nodeType === 3 && nextSibling.textContent.trim());
if (DEBUG) {
logDebug(`Adjusted background wrapper for parent ${parent.className}: width=${mainRightWidth}px, height=${adjustedHeight}px, computed height: ${computedStyle.height}`, 'orange');
logDebug(`Computed styles for wrapper: opacity=${computedStyle.opacity}, visibility=${computedStyle.visibility}, display=${computedStyle.display}, z-index=${computedStyle.zIndex}, background-image=${bgImage}`, 'purple');
logDebug(`Content after wrapper: ${hasContentAfter ? 'Yes' : 'No'}, Button height: ${buttonHeight}px, Separator adjustment: ${totalHeight - adjustedHeight}px`, hasContentAfter ? 'green' : 'yellow');
}
} else {
if (DEBUG) logDebug(`Parent ${parent.className} has zero or invalid height`, 'red');
}
} else {
if (DEBUG) logDebug('No parent .column or .section-hero--full found for background wrapper', 'red');
}
});
} else {
if (DEBUG) logDebug('main__right element not found', 'red');
}
}, 500); // Delay to ensure DOM and styles are ready
}
if (DEBUG) logDebug('Scheduling background wrapper adjustment');
adjustBackground();
window.addEventListener('load', adjustBackground);
window.addEventListener('resize', adjustBackground);
// [Rest of the script remains unchanged from Version 2.78]
// ... (renderEmbed, adjustDesktopLayout, openModal, closeModal functions remain the same)
});
</script>
Ensure your HTML includes the wrapper:
<div class="section-hero--full-wrapper">
<div class="section-hero--full">
<!-- Existing content -->
</div>
</div>
custom.css to 4.27 and pull-contents.php to 2.79.width: 100vw from .background-image-wrapper, leaving it to be set dynamically by the script.left: 50% and transform: translateX(-50%) to center the background within the calculated width.adjustBackground to set .background-image-wrapper’s width to .main__right’s width, measured via getBoundingClientRect().width.Update Files:
pull-contents.php with Version 2.79 (update the <script> section).custom.css with Version 4.27..section-hero--full-wrapper div around .section-hero--full.Test Background Image:
https://www.nlt-chaplaincy.org/index.html) in both desktop and mobile views..main__right without overflowing onto the left frame.Inspect Elements:
.background-image-wrapper:
width matches .main__right’s width (check the computed style after the script runs).height aligns with the section content plus button, stopping before the .separator..section-hero--full-wrapper contains .section-hero--full.Review Debug Log:
Adjusted background wrapper for parent messages, including the width and height values.Next Steps:
.main__right’s width, no overflow occurs, and the separator overlap is resolved..main__right and .background-image-wrapper dimensions and the DOM hierarchy. We might need to adjust the script to account for margins or padding in .main__right..main__right, while CSS sets the initial styling and positioning. This ensures the solution adapts to the browser’s layout.Please test this and let me know the results! If the width still doesn’t align, we can refine the script to include offsets or explore a CSS-only solution with calc().
.background-image-wrapper’s width, set to match .main__right’s width, might still be slightly misaligned due to factors like margins, padding, or the browser’s rendering context. This could be caused by .main__right’s computed width not accounting for its full layout context, or the centering (left: 50% and transform: translateX(-50%)) introducing a small offset. Let’s refine the script to ensure the width matches .main__right’s outer dimensions more precisely and adjust the positioning to eliminate the residual overflow..main__right’s margins, padding, or a slight misalignment in the centering transform.getBoundingClientRect().width gives the inner content width, but .main__right might have outer styling (e.g., box-sizing, margins) affecting its total width. The transform: translateX(-50%) might also shift the background slightly beyond the frame if not perfectly centered..main__right’s full width (accounting for margins if present) and fine-tune the positioning by aligning the wrapper’s left edge with .main__right’s left edge, then centering the background content..main__right’s full width, including any margins, and apply it to .background-image-wrapper.left to match .main__right’s left offset and remove the transform if possible, ensuring the wrapper aligns perfectly..section-hero--full-wrapper’s overflow-x: hidden to catch any residual overflow.custom.css (Version 4.28)/* Custom CSS for Lifenavi (navi.claudioflute.live) and Chaplaincy Admin (admin.nlt-chaplaincy.org) - Version 4.28 */
/* Shared styles for both systems, with domain-specific overrides as noted */
/* Ensure myButton overrides theme styles */
.content__buttons a.myButton {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
a.myButtonBig {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Button Styles */
.myButtonBig {
background: linear-gradient(to bottom, #44c767 5%, #5cbf2a 100%);
background-color: #44c767;
border-radius: 28px;
border: 1px solid #18ab29;
display: inline-block;
cursor: pointer;
color: #ffffff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 21px;
font-weight: bold;
padding: 24px 42px;
text-decoration: none;
text-shadow: 0px 1px 0px #2f6627;
transition: all 0.3s ease;
}
.myButtonBig:hover {
background: linear-gradient(to bottom, #5cbf2a 5%, #44c767 100%);
background-color: #5cbf2a;
border-color: #137c21;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.myButtonBig:active {
position: relative;
top: 1px;
background: linear-gradient(to bottom, #3ba052 5%, #4aa62b 100%);
background-color: #3ba052;
border-color: #0f5c18;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
.myButton {
background: linear-gradient(to bottom, #44c767 5%, #5cbf2a 100%);
background-color: #44c767;
border-radius: 28px;
border: 1px solid #18ab29;
display: inline-block;
cursor: pointer;
color: #ffffff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 17px;
font-weight: bold;
padding: 16px 31px;
text-decoration: none;
text-shadow: 0px 1px 0px #2f6627;
transition: all 0.3s ease;
}
.myButton:hover {
background: linear-gradient(to bottom, #5cbf2a 5%, #44c767 100%);
background-color: #5cbf2a;
border-color: #137c21;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.myButton:active {
position: relative;
top: 1px;
background: linear-gradient(to bottom, #3ba052 5%, #4aa62b 100%);
background-color: #3ba052;
border-color: #0f5c18;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
/* Set default font for the entire site */
body {
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Test class to verify font loading */
.font-test {
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 24px;
color: red;
}
/* Dynamic Section Styles */
.content__entry {
position: relative;
padding: 20px;
min-height: 200px;
margin: 0 auto;
max-width: 1200px;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-color: #fff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Hide empty content__entry div from Publii theme */
div.content__entry:empty {
display: none;
}
/* Alternative: Hide content__entry div on dynamic pages (uncomment and add data-page-type="dynamic" to <body> if needed) */
/* body[data-page-type="dynamic"] div.content__entry {
display: none;
} */
.section-hero--full-wrapper {
overflow-x: hidden; /* Contain overflow */
width: 100%;
max-width: 1200px;
margin: 0 auto;
position: relative; /* Ensure proper context */
}
.section-hero--full {
width: 100%; /* Ensure full width of container */
position: relative;
left: 0;
transform: none;
margin: 0 auto;
min-height: 0; /* Adapt to content height */
background-color: #fff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
overflow: visible; /* Prevent clipping */
padding: 0; /* Remove padding to allow full width */
}
.section-hero--column {
flex: 1;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
padding: 10px;
}
.section-group {
display: flex;
flex-wrap: nowrap; /* Prevent wrapping to new rows */
gap: 20px;
max-width: 1200px;
margin: 0 auto;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.layout-2-column {
display: flex;
justify-content: space-between;
}
.layout-2-column .section-hero--column {
flex: 1 0 49%; /* Slightly less than 50% to account for gap */
max-width: 49%;
}
.layout-3-column {
display: flex;
justify-content: space-between;
}
.layout-3-column .section-hero--column {
flex: 1 0 32%; /* Slightly less than 33.33% to account for gap */
max-width: 32%;
}
/* Layout and Button Styling (Moved from pull-contents.php) */
@media (min-width: 768px) {
.section-hero--full.layout-2-column .section-hero__content {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
}
.section-hero--full.layout-3-column .section-hero__content {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 20px;
}
.column {
width: 100%; /* Ensure columns take full width in grid */
position: relative; /* Provide containing block for absolute positioning */
min-height: 200px; /* Fallback minimum height */
overflow: visible; /* Prevent clipping of absolute child */
z-index: 0; /* Ensure content stays above background */
}
.content-embed {
width: 300px; /* Fixed width for uniformity */
margin: 0 auto; /* Center the embed container */
text-align: center; /* Center the button within */
}
.paypal-button {
width: 300px !important; /* Fixed width for all buttons */
max-width: 300px !important; /* Prevent overflow or shrinkage */
box-sizing: border-box; /* Include padding in width */
margin: 0 auto; /* Center the button */
}
.background-image-wrapper {
position: absolute;
top: 0;
left: 0; /* Align with container left, adjusted by script */
height: 100%; /* Use 100% of parent height */
background-size: cover;
background-position: center;
z-index: -1; /* Place behind content */
opacity: 1 !important; /* Force visibility */
visibility: visible !important; /* Ensure not hidden */
background-repeat: no-repeat !important; /* Prevent repeat issues */
background-color: rgba(0, 0, 255, 0.3); /* Blue tint as fallback */
}
.section-hero--full {
padding: 0; /* Remove padding to allow full width */
position: relative; /* Context for absolute positioning */
}
.section-hero__content {
position: relative;
width: 100%; /* Ensure full width */
min-height: 100%; /* Match section height */
box-sizing: border-box; /* Include padding in height */
}
.column {
padding: 0; /* Remove column padding to allow wrapper to fill */
box-sizing: border-box;
}
}
@media (max-width: 767px) {
.section-hero--full .section-hero__content {
display: block; /* Stack vertically on mobile */
}
.column {
margin-bottom: 20px; /* Add spacing between stacked sections */
width: 100%; /* Ensure full width on mobile */
position: relative; /* Provide containing block for absolute positioning */
min-height: 200px; /* Fallback minimum height */
overflow: visible; /* Prevent clipping of absolute child */
z-index: 0; /* Ensure content stays above background */
}
.content-embed {
width: 100% !important; /* Force full width on mobile, overriding SDK styles */
}
.paypal-button {
width: 100% !important; /* Force PayPal button to full width on mobile */
max-width: none !important; /* Remove any max-width constraints */
}
.content__buttons {
text-align: center !important; /* Center align buttons on mobile */
}
.background-image-wrapper {
position: absolute;
top: 0;
left: 0; /* Align with container left, adjusted by script */
height: 100%; /* Use 100% of parent height */
background-size: cover;
background-position: center;
z-index: -1; /* Place behind content */
opacity: 1 !important; /* Force visibility */
visibility: visible !important; /* Ensure not hidden */
background-repeat: no-repeat !important; /* Prevent repeat issues */
background-color: rgba(0, 0, 255, 0.3); /* Blue tint as fallback */
}
.section-hero--full {
padding: 0; /* Remove padding to allow full width */
position: relative; /* Context for absolute positioning */
}
.section-hero__content {
position: relative;
width: 100%; /* Ensure full width */
min-height: 100%; /* Match section height */
box-sizing: border-box; /* Include padding in height */
}
.column {
padding: 0; /* Remove column padding to allow wrapper to fill */
box-sizing: border-box;
}
}
/* Alignment Classes */
.align-left {
text-align: left;
}
.content-image.align-left, .video-embed.align-left {
margin: 1em 0;
}
.align-center {
text-align: center;
}
/* Override theme's heading font variable */
h1, h2, h3, h4, h5, h6 {
font-family: "LXGW WenKai TC", "Times New Roman", serif !important;
margin-bottom: 1.5em !important;
}
/* Ensure specific heading styles inherit the font */
.content__entry h1 {
font-size: 2em;
font-weight: 700;
line-height: 1.2;
color: #333;
margin-bottom: 1.5em !important;
padding-top: 1em;
text-align: center;
text-shadow: none;
font-family: "LXGW WenKai TC", "Times New Roman", serif !important;
}
.generic-content {
margin: 0 auto;
max-width: 800px;
font-size: 1em;
line-height: 1.6;
color: #333;
margin-bottom: 1em;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.content__entry[style*="background-image"] h1,
.content__entry[style*="background-image"] .generic-content {
color: #fff !important; /* Auto-switch to white with background image */
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}
/* Optional manual override for font color */
.content__entry[data-font-color="custom"] h1,
.content__entry[data-font-color="custom"] .generic-content {
color: var(--custom-font-color, #333) !important;
}
.generic-content p {
margin: 0 0 1em 0;
}
.generic-content ul,
.generic-content ol {
margin: 0 0 1em 0;
padding: 0 !important;
list-style: none !important;
}
.generic-content li {
margin-bottom: 0.5em;
text-align: inherit;
list-style: none !important;
}
.generic-content ul[style*="list-style"],
.generic-content ol[style*="list-style"],
.generic-content li[style*="list-style"] {
list-style: none !important;
}
.content__buttons {
text-align: center !important; /* Default center alignment */
margin: 2em 0 1em 0;
position: relative; /* Ensure it’s part of the flow */
z-index: 1; /* Keep above background */
}
.content__buttons a.myButton {
display: inline-block;
margin: 0 auto;
}
.content__entry .content__buttons {
text-align: center !important;
}
/* Remove white space for title-text model when no image */
.column[data-model="title-text"]:not(:has(.content-image)) {
min-height: 0 !important;
padding-bottom: 0 !important;
}
/* Adjust for title-text model without image */
.column[data-model="title-text"]:not(:has(.content-image)) .generic-content {
margin-bottom: 0 !important;
}
.welcome-image {
max-width: 100%;
height: auto;
margin: 1em auto;
display: block;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.video-embed {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
margin: 1em auto;
max-width: 800px;
background: none;
}
.video-embed iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
}
.separator {
text-align: center;
margin: 60px 0 20px 0;
}
.content__entry.content__entry--full:first-child {
min-height: 0 !important;
padding-top: 0 !important;
margin-top: 0 !important;
}
.main.page .main__right:first-child {
margin-top: -3.8rem !important;
}
.main.page .main__right {
margin: 0% !important;
}
.banner--after-content {
margin: 0 !important;
padding: 0 !important;
border: none !important;
outline: none !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
@media (max-width: 768px) {
.main.page .main__right:first-child {
margin-top: 0 !important;
margin-bottom: 0 !important;
}
.main.page .container:first-child,
.main.page .post__entry:first-child {
margin: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.main.page .main__right .main__right--bottom:first-child {
margin-top: -3.8rem !important;
margin-bottom: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.main.page .container > .main__right > .main__right--bottom:first-child,
.main.page .post__entry > .main__right > .main__right--bottom:first-child {
margin: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.banner--after-content {
margin: 0 !important;
padding: 0 !important;
border: none !important;
outline: none !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
}
@media (min-width: 769px) and (max-width: 1023px) {
.main.page .main__right {
margin: 0 auto !important;
max-width: 90% !important;
width: auto !important;
}
.main.page .main__right .content__entry--full {
margin: 0 auto !important;
max-width: 100% !important;
}
.main.page .main__right .main__right--bottom {
margin: 0 auto !important;
max-width: 100% !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
}
.main.page .main__right .main__right--bottom .section-hero--full:first-child {
margin-top: 0 !important;
padding-top: 0 !important;
}
.content__entry.content__entry--full .separator:first-child {
margin-top: 0;
}
.section-hero--full:not([style*="background-image"]) + .separator {
margin-top: 40px;
}
.separator-image {
max-width: 100%;
height: auto;
display: block;
margin: 0 auto;
}
.separator img[src$="down_arrow.png"] {
max-width: 256px;
}
hr {
display: none !important;
visibility: hidden !important;
}
.post__content hr,
.container hr,
.post__content hr[style],
.container hr[style] {
display: none !important;
visibility: hidden !important;
}
.post__content::before,
.post__content::after,
.container::before,
.container::after,
.post__entry::before,
.post__entry::after,
.content__entry::before,
.content__entry::after,
.generic-content::before,
.generic-content::after {
display: none !important;
border: none !important;
content: none !important;
}
.separator::before,
.separator::after {
display: none !important;
border: none !important;
content: none !important;
}
body,
body p,
body h2,
body h3,
body h4,
body h5,
body h6,
.post__content,
.post__content p,
.post__content h2,
.post__content h3,
.post__content h4,
.post__content h5,
.post__content h6,
.container,
.container p,
.container h2,
.container h3,
.container h4,
.container h5,
.container h6 {
color: #333 !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
h1.post__title,
h1.hero__title,
h1.site__title {
color: #fff !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
a.button,
a.btn,
a.post__button,
.post__content a.button,
.post__content a.btn,
.post__content a.post__button,
.container a.button,
.container a.btn,
.container a.post__button {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Custom Modal Styles */
.modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.5);
}
.modal-content {
background-color: #fff;
margin: 5% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 800px;
min-height: 200px;
position: relative;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
box-sizing: border-box;
}
.modal-close {
color: #aaa;
position: absolute;
top: 10px;
right: 20px;
font-size: 28px;
font-weight: bold;
cursor: pointer;
transition: color 0.3s ease;
z-index: 1001;
}
.modal-close:hover,
.modal-close:focus {
color: #000;
text-decoration: none;
}
#modal-body {
font-size: 1em;
line-height: 1.6;
color: #333;
max-width: 100%;
box-sizing: border-box;
padding-top: 40px;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
overflow-x: hidden;
}
#modal-body h1 {
font-size: 1.5em;
margin-bottom: 0.5em;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
#modal-body p {
margin-bottom: 1em;
}
#modal-body * {
max-width: 100%;
height: auto;
box-sizing: border-box;
}
#modal-body img,
#modal-body div,
#modal-body table {
max-width: 100%;
height: auto;
}
#modal-body .welcome-image {
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.modal[aria-hidden="false"] {
display: block;
}
.modal-close:focus {
outline: 2px solid #44c767;
outline-offset: 2px;
}
/* Custom separator for modal sections */
.modal-section-separator {
text-align: center;
margin: 20px 0;
font-size: 24px;
line-height: 1;
color: #666;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.modal-section-separator::before {
content: "···";
}
/* Modal-specific content container */
.modal-story-content {
max-width: 100%;
margin: 0 auto;
padding: 20px;
box-sizing: border-box;
overflow-x: hidden;
}
.modal-story-content h1 {
font-size: 2rem;
margin-bottom: 1rem;
text-align: center;
}
.modal-story-content .content-image {
max-width: 100%;
margin: 1rem 0;
}
.modal-story-content .generic-content {
font-size: 1rem;
line-height: 1.6;
}
/* Hide background image in modal */
.modal .background-image-wrapper {
display: none !important;
}
/* Chaplaincy Admin specific overrides */
.report-container {
max-width: 100% !important;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.content__entry {
max-width: 100% !important;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
box-sizing: border-box !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.content__entry table.report-table {
width: 100% !important;
margin: 0 !important;
padding: 0 !important;
border-collapse: collapse !important;
box-sizing: border-box !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Fix background image rendering */
.section-hero--full .section-hero__content,
.section-hero--full .column {
position: relative; /* Containing block for absolute positioning */
min-height: 200px; /* Fallback minimum height */
overflow: visible; /* Prevent clipping of absolute child */
width: 100%; /* Ensure full width */
box-sizing: border-box; /* Include padding in dimensions */
}
.section-hero--full .background-image-wrapper {
position: absolute;
top: 0;
left: 0; /* Adjusted by script to match main__right left */
height: 100%; /* Use 100% of parent height */
background-size: cover;
background-position: center;
z-index: -1; /* Place behind content */
opacity: 1 !important; /* Force visibility */
visibility: visible !important; /* Ensure not hidden */
background-repeat: no-repeat !important; /* Prevent repeat issues */
background-color: rgba(0, 0, 0, 0.3); /* Updated to black tint as fallback */
}
/* Add to custom.css or a Chaplaincy-specific file */
html, body {
overflow-x: hidden;
width: 100%;
margin: 0;
padding: 0;
}
.main.page, .container, .post__entry {
width: 100%;
max-width: 100%;
overflow-x: hidden;
}
/* PP Button Layout Adjustments */
@media (min-width: 769px) {
.layout-3-column.position-100 .section-hero--column {
flex: 1 0 32%;
max-width: 32%;
}
}
@media (max-width: 768px) {
.layout-3-column.position-100 .section-hero--column {
flex: 1 0 100%;
max-width: 100%;
}
}
.section-group.position-100,
.section-hero--full {
margin-top: 2em;
}
/* Remove shadow from section images */
.content-image img,
.welcome-image {
box-shadow: none !important;
-webkit-box-shadow: none !important; /* For Safari compatibility */
-moz-box-shadow: none !important; /* For Firefox compatibility */
}
/* Ensure no border or other effects interfere */
.content-image,
.modal-image {
box-shadow: none !important;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
}
pull-contents.php (Version 2.80)(Only the script section is updated for brevity; the rest remains as in 2.79)
<script>
document.addEventListener('DOMContentLoaded', function() {
// Synchronize with PHP DEBUG setting
const DEBUG = <?php echo DEBUG ? 'true' : 'false'; ?>;
// Debug log setup
let debugLog = null;
if (DEBUG) {
debugLog = document.createElement('div');
debugLog.id = 'debug-log';
debugLog.style.position = 'fixed';
debugLog.style.bottom = '10px';
debugLog.style.left = '10px';
debugLog.style.background = 'rgba(0, 0, 0, 0.8)';
debugLog.style.color = 'white';
debugLog.style.padding = '10px';
debugLog.style.zIndex = '1000';
debugLog.style.maxHeight = '200px';
debugLog.style.overflowY = 'auto';
document.body.appendChild(debugLog);
}
function logDebug(message, color = 'green') {
if (DEBUG && debugLog) {
debugLog.insertAdjacentHTML('beforeend', `<div style="color: ${color}; font-weight: bold;">Debug: ${message}</div>`);
debugLog.scrollTop = debugLog.scrollHeight;
}
if (DEBUG && console) console.log(`Debug: ${message}`, { color });
}
// Adjust background wrapper width and height with delayed execution and style logging
function adjustBackground() {
setTimeout(() => {
const mainRight = document.querySelector('.main__right');
if (mainRight) {
const mainRightRect = mainRight.getBoundingClientRect();
const mainRightWidth = mainRightRect.width; // Inner width
const mainRightLeft = mainRightRect.left; // Left offset from viewport
const wrappers = document.querySelectorAll('.background-image-wrapper');
if (DEBUG) logDebug(`Found ${wrappers.length} background-image-wrapper elements, main__right width: ${mainRightWidth}px, left: ${mainRightLeft}px`, wrappers.length > 0 ? 'green' : 'red');
wrappers.forEach(wrapper => {
const parent = wrapper.closest('.column');
const section = parent.closest('.section-hero--full');
if (section) {
// Set width and left position to match main__right
wrapper.style.width = `${mainRightWidth}px`;
wrapper.style.left = `${mainRightLeft}px`;
const sectionHeight = section.getBoundingClientRect().height;
const button = section.querySelector('.content__buttons');
const buttonHeight = button ? button.getBoundingClientRect().height : 0;
const totalHeight = sectionHeight + buttonHeight; // Include button height
const separator = section.nextElementSibling;
const sepTop = separator && separator.classList.contains('separator') ? separator.getBoundingClientRect().top : Infinity;
const adjustedHeight = Math.min(totalHeight, sepTop - section.getBoundingClientRect().top - 10); // Subtract 10px buffer
if (adjustedHeight > 0) {
wrapper.style.height = `${adjustedHeight}px`;
const computedStyle = window.getComputedStyle(wrapper);
const bgImage = computedStyle.backgroundImage;
const nextSibling = wrapper.nextSibling;
const hasContentAfter = nextSibling && (nextSibling.nodeType === 1 || nextSibling.nodeType === 3 && nextSibling.textContent.trim());
if (DEBUG) {
logDebug(`Adjusted background wrapper for parent ${parent.className}: width=${mainRightWidth}px, left=${mainRightLeft}px, height=${adjustedHeight}px, computed height: ${computedStyle.height}`, 'orange');
logDebug(`Computed styles for wrapper: opacity=${computedStyle.opacity}, visibility=${computedStyle.visibility}, display=${computedStyle.display}, z-index=${computedStyle.zIndex}, background-image=${bgImage}`, 'purple');
logDebug(`Content after wrapper: ${hasContentAfter ? 'Yes' : 'No'}, Button height: ${buttonHeight}px, Separator adjustment: ${totalHeight - adjustedHeight}px`, hasContentAfter ? 'green' : 'yellow');
}
} else {
if (DEBUG) logDebug(`Parent ${parent.className} has zero or invalid height`, 'red');
}
} else {
if (DEBUG) logDebug('No parent .column or .section-hero--full found for background wrapper', 'red');
}
});
} else {
if (DEBUG) logDebug('main__right element not found', 'red');
}
}, 500); // Delay to ensure DOM and styles are ready
}
if (DEBUG) logDebug('Scheduling background wrapper adjustment');
adjustBackground();
window.addEventListener('load', adjustBackground);
window.addEventListener('resize', adjustBackground);
// [Rest of the script remains unchanged from Version 2.79]
// ... (renderEmbed, adjustDesktopLayout, openModal, closeModal functions remain the same)
});
</script>
Ensure your HTML includes the wrapper:
<div class="section-hero--full-wrapper">
<div class="section-hero--full">
<!-- Existing content -->
</div>
</div>
custom.css to 4.28 and pull-contents.php to 2.80.left: 50% and transform: translateX(-50%) from .background-image-wrapper, allowing the script to set left based on .main__right’s position.height: 100% and other styling intact.adjustBackground to use .main__right.getBoundingClientRect().left to set the left property, aligning the wrapper with .main__right’s left edge..main__right’s width, ensuring it fills the frame without overflow.Update Files:
pull-contents.php with Version 2.80 (update the <script> section).custom.css with Version 4.28..section-hero--full-wrapper div around .section-hero--full.Test Background Image:
https://www.nlt-chaplaincy.org/index.html) in both desktop and mobile views..main__right’s width with no overflow onto the left frame.Inspect Elements:
.background-image-wrapper:
width matches .main__right’s width and left matches .main__right’s left offset.height aligns with the section content plus button, stopping before the .separator.Review Debug Log:
Adjusted background wrapper for parent messages, including the width, left, and height values..main__right and .background-image-wrapper dimensions.Next Steps:
.main__right, eliminating the narrow overflow..main__right and .background-image-wrapper dimensions, along with the DOM hierarchy. We might need to adjust for margins (e.g., mainRightRect.left + parseFloat(getComputedStyle(mainRight).marginLeft || 0)) or use a different reference element..main__right’s layout, which should resolve the issue if the browser renders it consistently.Please test this and let me know the results! If the overflow remains, we can further refine the script or explore a CSS-based calc() approach based on .main__right’s width.
.section-hero--full-wrapper div is included by leveraging Publii’s templating system. Publii allows you to customize the generated HTML through its theme files, specifically by editing the PHP templates that control the structure of your pages. This way, you can wrap the .section-hero--full div with the wrapper div as part of the theme’s rendering process.Locate the Theme Files:
input/themes/your-theme-name/ within your Publii installation).Identify the Relevant Template:
.section-hero--full div is likely generated within a template that handles your dynamic sections or main content area. Common files to check include:
index.php (for the homepage layout).post.php (for individual post pages).page.php (for static pages).partials/content.php or a similar partial file (if your theme uses includes for content blocks).<div class="section-hero--full"> element. This might be within a loop or conditional block rendering your sections.Add the Wrapper Div:
.section-hero--full div with a .section-hero--full-wrapper div in the appropriate template. For example, if the template contains:
<div class="section-hero--full">
<!-- Content -->
</div>
Modify it to:
<div class="section-hero--full-wrapper">
<div class="section-hero--full">
<!-- Content -->
</div>
</div>.section-hero--full is part of a loop (e.g., iterating over sections), apply the wrapper around the loop’s output or within the loop for each instance. For example:
<?php foreach ($sections as $section): ?>
<div class="section-hero--full-wrapper">
<div class="section-hero--full">
<?php echo $section['content']; ?>
</div>
</div>
<?php endforeach; ?>Save and Regenerate:
Verify the Change:
index.html or a post page) in a text editor or browser inspector (F12) to confirm the wrapper div is present.<div class="section-hero--full-wrapper">
<div class="section-hero--full">
<!-- Content -->
</div>
</div>Troubleshooting:
.section-hero--full Isn’t Found: It might be generated by a custom plugin or widget. Check the theme’s widgets folder or consult Publii’s documentation/support for where dynamic sections are defined..section-hero--full divs (e.g., in a loop or multiple template files)..section-hero--full is added via your pull-contents.php script (e.g., injecting content dynamically), you’ll need to adjust the script to wrap the output. Modify the script’s logic where .section-hero--full is created to include the wrapper. For example:
echo '<div class="section-hero--full-wrapper">';
echo '<div class="section-hero--full">';
// Existing content output
echo '</div>';
echo '</div>';custom.css (Version 4.28) and pull-contents.php (Version 2.80) from the previous response to ensure the overflow fix works with the new structure..section-hero--full, share the theme name or a sample of your generated HTML (e.g., via a text snippet), and I can guide you more specifically.This approach should integrate the wrapper into your Publii-generated pages without requiring manual HTML edits after each regeneration.
This fix roll back the display to the very first state with non-extending background image on both desktop and mobile views. With these few fixes do you think we are heading on the right track? I initially thought that since the main_right are is having certain width (fixed or determined dynamically) it would be straight forward to fix the background image using regular CSS which can certainly fill up the entire content area (100% width) without knowing the accurate width. But it seems that things are not as simple as that...
width: 100% approach isn’t sufficient due to the dynamic nature of .main__right’s width and its context within Publii’s theme, which likely involves nested containers, margins, or responsive adjustments that affect the layout. Let’s reflect on our progress and adjust the strategy to get back on track..section-hero--full without accounting for the full frame..section-hero--full-wrapper with overflow-x: hidden and width: 100vw aimed to extend the background but caused overflow issues due to viewport misalignment..background-image-wrapper’s width to .main__right’s width with dynamic scripting reduced overflow but introduced shifts and white spaces, especially across device views.left to 0 and using .main__right’s width, reverted to the non-extending state, likely because the parent .section-hero--full’s overflow: hidden clipped the background prematurely without proper width adjustment..main__right’s width varies (fixed or dynamic) based on the theme’s layout, and its position relative to the viewport or parent containers complicates absolute positioning..main.page, .container) add layers that affect how widths and overflows are calculated.background-image-wrapper’s absolute positioning requires a precise reference point, which CSS alone can’t dynamically adapt without knowing the exact context.Your initial intuition—that the background should fill the content area with a simple width: 100%—is valid, but the complication arises because .section-hero--full’s width doesn’t always match .main__right’s visible width due to padding, margins, or theme-specific constraints. Instead of tying the background to .main__right’s absolute dimensions, let’s:
.section-hero--full’s width as the base, ensuring the background extends to its full content area.width: 100% to .background-image-wrapper relative to .section-hero--full, with the script adjusting only the height to avoid separator overlap.overflow: hidden at the appropriate level to contain the background without clipping it prematurely..background-image-wrapper to width: 100% within .section-hero--full, and ensure the parent handles overflow.custom.css (Version 4.31)/* Custom CSS for Lifenavi (navi.claudioflute.live) and Chaplaincy Admin (admin.nlt-chaplaincy.org) - Version 4.31 */
/* Shared styles for both systems, with domain-specific overrides as noted */
/* Ensure myButton overrides theme styles */
.content__buttons a.myButton {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
a.myButtonBig {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Button Styles */
.myButtonBig {
background: linear-gradient(to bottom, #44c767 5%, #5cbf2a 100%);
background-color: #44c767;
border-radius: 28px;
border: 1px solid #18ab29;
display: inline-block;
cursor: pointer;
color: #ffffff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 21px;
font-weight: bold;
padding: 24px 42px;
text-decoration: none;
text-shadow: 0px 1px 0px #2f6627;
transition: all 0.3s ease;
}
.myButtonBig:hover {
background: linear-gradient(to bottom, #5cbf2a 5%, #44c767 100%);
background-color: #5cbf2a;
border-color: #137c21;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.myButtonBig:active {
position: relative;
top: 1px;
background: linear-gradient(to bottom, #3ba052 5%, #4aa62b 100%);
background-color: #3ba052;
border-color: #0f5c18;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
.myButton {
background: linear-gradient(to bottom, #44c767 5%, #5cbf2a 100%);
background-color: #44c767;
border-radius: 28px;
border: 1px solid #18ab29;
display: inline-block;
cursor: pointer;
color: #ffffff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 17px;
font-weight: bold;
padding: 16px 31px;
text-decoration: none;
text-shadow: 0px 1px 0px #2f6627;
transition: all 0.3s ease;
}
.myButton:hover {
background: linear-gradient(to bottom, #5cbf2a 5%, #44c767 100%);
background-color: #5cbf2a;
border-color: #137c21;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.myButton:active {
position: relative;
top: 1px;
background: linear-gradient(to bottom, #3ba052 5%, #4aa62b 100%);
background-color: #3ba052;
border-color: #0f5c18;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
/* Set default font for the entire site */
body {
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Test class to verify font loading */
.font-test {
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 24px;
color: red;
}
/* Dynamic Section Styles */
.content__entry {
position: relative;
padding: 20px;
min-height: 200px;
margin: 0 auto;
max-width: 1200px;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-color: #fff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Hide empty content__entry div from Publii theme */
div.content__entry:empty {
display: none;
}
/* Alternative: Hide content__entry div on dynamic pages (uncomment and add data-page-type="dynamic" to <body> if needed) */
/* body[data-page-type="dynamic"] div.content__entry {
display: none;
} */
.section-hero--full {
width: 100%; /* Ensure full width of container */
position: relative;
left: 0;
transform: none;
margin: 0 auto;
min-height: 0; /* Adapt to content height */
background-color: #fff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
overflow: hidden; /* Clip overflow to contain background */
padding: 0; /* Remove padding to allow full width */
}
.section-hero--column {
flex: 1;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
padding: 10px;
}
.section-group {
display: flex;
flex-wrap: nowrap; /* Prevent wrapping to new rows */
gap: 20px;
max-width: 1200px;
margin: 0 auto;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.layout-2-column {
display: flex;
justify-content: space-between;
}
.layout-2-column .section-hero--column {
flex: 1 0 49%; /* Slightly less than 50% to account for gap */
max-width: 49%;
}
.layout-3-column {
display: flex;
justify-content: space-between;
}
.layout-3-column .section-hero--column {
flex: 1 0 32%; /* Slightly less than 33.33% to account for gap */
max-width: 32%;
}
/* Layout and Button Styling (Moved from pull-contents.php) */
@media (min-width: 768px) {
.section-hero--full.layout-2-column .section-hero__content {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
}
.section-hero--full.layout-3-column .section-hero__content {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 20px;
}
.column {
width: 100%; /* Ensure columns take full width in grid */
position: relative; /* Provide containing block for absolute positioning */
min-height: 200px; /* Fallback minimum height */
overflow: visible; /* Prevent clipping of absolute child */
z-index: 0; /* Ensure content stays above background */
}
.content-embed {
width: 300px; /* Fixed width for uniformity */
margin: 0 auto; /* Center the embed container */
text-align: center; /* Center the button within */
}
.paypal-button {
width: 300px !important; /* Fixed width for all buttons */
max-width: 300px !important; /* Prevent overflow or shrinkage */
box-sizing: border-box; /* Include padding in width */
margin: 0 auto; /* Center the button */
}
.background-image-wrapper {
position: absolute;
top: 0;
left: 0; /* Align with parent left */
width: 100%; /* Fill parent width */
height: 100%; /* Use 100% of parent height */
background-size: cover;
background-position: center;
z-index: -1; /* Place behind content */
opacity: 1 !important; /* Force visibility */
visibility: visible !important; /* Ensure not hidden */
background-repeat: no-repeat !important; /* Prevent repeat issues */
background-color: rgba(0, 0, 0, 0.3); /* Updated to black tint as fallback */
}
.section-hero--full {
padding: 0; /* Remove padding to allow full width */
position: relative; /* Context for absolute positioning */
}
.section-hero__content {
position: relative;
width: 100%; /* Ensure full width */
min-height: 100%; /* Match section height */
box-sizing: border-box; /* Include padding in height */
}
.column {
padding: 0; /* Remove column padding to allow wrapper to fill */
box-sizing: border-box;
}
}
@media (max-width: 767px) {
.section-hero--full .section-hero__content {
display: block; /* Stack vertically on mobile */
}
.column {
margin-bottom: 20px; /* Add spacing between stacked sections */
width: 100%; /* Ensure full width on mobile */
position: relative; /* Provide containing block for absolute positioning */
min-height: 200px; /* Fallback minimum height */
overflow: visible; /* Prevent clipping of absolute child */
z-index: 0; /* Ensure content stays above background */
}
.content-embed {
width: 100% !important; /* Force full width on mobile, overriding SDK styles */
}
.paypal-button {
width: 100% !important; /* Force PayPal button to full width on mobile */
max-width: none !important; /* Remove any max-width constraints */
}
.content__buttons {
text-align: center !important; /* Center align buttons on mobile */
}
.background-image-wrapper {
position: absolute;
top: 0;
left: 0; /* Align with parent left */
width: 100%; /* Fill parent width */
height: 100%; /* Use 100% of parent height */
background-size: cover;
background-position: center;
z-index: -1; /* Place behind content */
opacity: 1 !important; /* Force visibility */
visibility: visible !important; /* Ensure not hidden */
background-repeat: no-repeat !important; /* Prevent repeat issues */
background-color: rgba(0, 0, 0, 0.3); /* Updated to black tint as fallback */
}
.section-hero--full {
padding: 0; /* Remove padding to allow full width */
position: relative; /* Context for absolute positioning */
}
.section-hero__content {
position: relative;
width: 100%; /* Ensure full width */
min-height: 100%; /* Match section height */
box-sizing: border-box; /* Include padding in height */
}
.column {
padding: 0; /* Remove column padding to allow wrapper to fill */
box-sizing: border-box;
}
}
/* Alignment Classes */
.align-left {
text-align: left;
}
.content-image.align-left, .video-embed.align-left {
margin: 1em 0;
}
.align-center {
text-align: center;
}
/* Override theme's heading font variable */
h1, h2, h3, h4, h5, h6 {
font-family: "LXGW WenKai TC", "Times New Roman", serif !important;
margin-bottom: 1.5em !important;
}
/* Ensure specific heading styles inherit the font */
.content__entry h1 {
font-size: 2em;
font-weight: 700;
line-height: 1.2;
color: #333;
margin-bottom: 1.5em !important;
padding-top: 1em;
text-align: center;
text-shadow: none;
font-family: "LXGW WenKai TC", "Times New Roman", serif !important;
}
.generic-content {
margin: 0 auto;
max-width: 800px;
font-size: 1em;
line-height: 1.6;
color: #333;
margin-bottom: 1em;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.content__entry[style*="background-image"] h1,
.content__entry[style*="background-image"] .generic-content {
color: #fff !important; /* Auto-switch to white with background image */
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}
/* Optional manual override for font color */
.content__entry[data-font-color="custom"] h1,
.content__entry[data-font-color="custom"] .generic-content {
color: var(--custom-font-color, #333) !important;
}
.generic-content p {
margin: 0 0 1em 0;
}
.generic-content ul,
.generic-content ol {
margin: 0 0 1em 0;
padding: 0 !important;
list-style: none !important;
}
.generic-content li {
margin-bottom: 0.5em;
text-align: inherit;
list-style: none !important;
}
.generic-content ul[style*="list-style"],
.generic-content ol[style*="list-style"],
.generic-content li[style*="list-style"] {
list-style: none !important;
}
.content__buttons {
text-align: center !important; /* Default center alignment */
margin: 2em 0 1em 0;
position: relative; /* Ensure it’s part of the flow */
z-index: 1; /* Keep above background */
}
.content__buttons a.myButton {
display: inline-block;
margin: 0 auto;
}
.content__entry .content__buttons {
text-align: center !important;
}
/* Remove white space for title-text model when no image */
.column[data-model="title-text"]:not(:has(.content-image)) {
min-height: 0 !important;
padding-bottom: 0 !important;
}
/* Adjust for title-text model without image */
.column[data-model="title-text"]:not(:has(.content-image)) .generic-content {
margin-bottom: 0 !important;
}
.welcome-image {
max-width: 100%;
height: auto;
margin: 1em auto;
display: block;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.video-embed {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
margin: 1em auto;
max-width: 800px;
background: none;
}
.video-embed iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
}
.separator {
text-align: center;
margin: 60px 0 20px 0;
}
.content__entry.content__entry--full:first-child {
min-height: 0 !important;
padding-top: 0 !important;
margin-top: 0 !important;
}
.main.page .main__right:first-child {
margin-top: -3.8rem !important;
}
.main.page .main__right {
margin: 0% !important;
}
.banner--after-content {
margin: 0 !important;
padding: 0 !important;
border: none !important;
outline: none !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
@media (max-width: 768px) {
.main.page .main__right:first-child {
margin-top: 0 !important;
margin-bottom: 0 !important;
}
.main.page .container:first-child,
.main.page .post__entry:first-child {
margin: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.main.page .main__right .main__right--bottom:first-child {
margin-top: -3.8rem !important;
margin-bottom: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.main.page .container > .main__right > .main__right--bottom:first-child,
.main.page .post__entry > .main__right > .main__right--bottom:first-child {
margin: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.banner--after-content {
margin: 0 !important;
padding: 0 !important;
border: none !important;
outline: none !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
}
@media (min-width: 769px) and (max-width: 1023px) {
.main.page .main__right {
margin: 0 auto !important;
max-width: 90% !important;
width: auto !important;
}
.main.page .main__right .content__entry--full {
margin: 0 auto !important;
max-width: 100% !important;
}
.main.page .main__right .main__right--bottom {
margin: 0 auto !important;
max-width: 100% !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
}
.main.page .main__right .main__right--bottom .section-hero--full:first-child {
margin-top: 0 !important;
padding-top: 0 !important;
}
.content__entry.content__entry--full .separator:first-child {
margin-top: 0;
}
.section-hero--full:not([style*="background-image"]) + .separator {
margin-top: 40px;
}
.separator-image {
max-width: 100%;
height: auto;
display: block;
margin: 0 auto;
}
.separator img[src$="down_arrow.png"] {
max-width: 256px;
}
hr {
display: none !important;
visibility: hidden !important;
}
.post__content hr,
.container hr,
.post__content hr[style],
.container hr[style] {
display: none !important;
visibility: hidden !important;
}
.post__content::before,
.post__content::after,
.container::before,
.container::after,
.post__entry::before,
.post__entry::after,
.content__entry::before,
.content__entry::after,
.generic-content::before,
.generic-content::after {
display: none !important;
border: none !important;
content: none !important;
}
.separator::before,
.separator::after {
display: none !important;
border: none !important;
content: none !important;
}
body,
body p,
body h2,
body h3,
body h4,
body h5,
body h6,
.post__content,
.post__content p,
.post__content h2,
.post__content h3,
.post__content h4,
.post__content h5,
.post__content h6,
.container,
.container p,
.container h2,
.container h3,
.container h4,
.container h5,
.container h6 {
color: #333 !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
h1.post__title,
h1.hero__title,
h1.site__title {
color: #fff !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
a.button,
a.btn,
a.post__button,
.post__content a.button,
.post__content a.btn,
.post__content a.post__button,
.container a.button,
.container a.btn,
.container a.post__button {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Custom Modal Styles */
.modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.5);
}
.modal-content {
background-color: #fff;
margin: 5% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 800px;
min-height: 200px;
position: relative;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
box-sizing: border-box;
}
.modal-close {
color: #aaa;
position: absolute;
top: 10px;
right: 20px;
font-size: 28px;
font-weight: bold;
cursor: pointer;
transition: color 0.3s ease;
z-index: 1001;
}
.modal-close:hover,
.modal-close:focus {
color: #000;
text-decoration: none;
}
#modal-body {
font-size: 1em;
line-height: 1.6;
color: #333;
max-width: 100%;
box-sizing: border-box;
padding-top: 40px;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
overflow-x: hidden;
}
#modal-body h1 {
font-size: 1.5em;
margin-bottom: 0.5em;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
#modal-body p {
margin-bottom: 1em;
}
#modal-body * {
max-width: 100%;
height: auto;
box-sizing: border-box;
}
#modal-body img,
#modal-body div,
#modal-body table {
max-width: 100%;
height: auto;
}
#modal-body .welcome-image {
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.modal[aria-hidden="false"] {
display: block;
}
.modal-close:focus {
outline: 2px solid #44c767;
outline-offset: 2px;
}
/* Custom separator for modal sections */
.modal-section-separator {
text-align: center;
margin: 20px 0;
font-size: 24px;
line-height: 1;
color: #666;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.modal-section-separator::before {
content: "···";
}
/* Modal-specific content container */
.modal-story-content {
max-width: 100%;
margin: 0 auto;
padding: 20px;
box-sizing: border-box;
overflow-x: hidden;
}
.modal-story-content h1 {
font-size: 2rem;
margin-bottom: 1rem;
text-align: center;
}
.modal-story-content .content-image {
max-width: 100%;
margin: 1rem 0;
}
.modal-story-content .generic-content {
font-size: 1rem;
line-height: 1.6;
}
/* Hide background image in modal */
.modal .background-image-wrapper {
display: none !important;
}
/* Chaplaincy Admin specific overrides */
.report-container {
max-width: 100% !important;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.content__entry {
max-width: 100% !important;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
box-sizing: border-box !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.content__entry table.report-table {
width: 100% !important;
margin: 0 !important;
padding: 0 !important;
border-collapse: collapse !important;
box-sizing: border-box !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Fix background image rendering */
.section-hero--full .section-hero__content,
.section-hero--full .column {
position: relative; /* Containing block for absolute positioning */
min-height: 200px; /* Fallback minimum height */
overflow: hidden; /* Clip overflow to contain background */
width: 100%; /* Ensure full width */
box-sizing: border-box; /* Include padding in dimensions */
}
.section-hero--full .background-image-wrapper {
position: absolute;
top: 0;
left: 0; /* Align with parent left */
width: 100%; /* Fill parent width */
height: 100%; /* Use 100% of parent height */
background-size: cover;
background-position: center;
z-index: -1; /* Place behind content */
opacity: 1 !important; /* Force visibility */
visibility: visible !important; /* Ensure not hidden */
background-repeat: no-repeat !important; /* Prevent repeat issues */
background-color: rgba(0, 0, 0, 0.3); /* Updated to black tint as fallback */
}
/* Add to custom.css or a Chaplaincy-specific file */
html, body {
overflow-x: hidden;
width: 100%;
margin: 0;
padding: 0;
}
.main.page, .container, .post__entry {
width: 100%;
max-width: 100%;
overflow-x: hidden;
}
/* PP Button Layout Adjustments */
@media (min-width: 769px) {
.layout-3-column.position-100 .section-hero--column {
flex: 1 0 32%;
max-width: 32%;
}
}
@media (max-width: 768px) {
.layout-3-column.position-100 .section-hero--column {
flex: 1 0 100%;
max-width: 100%;
}
}
.section-group.position-100,
.section-hero--full {
margin-top: 2em;
}
/* Remove shadow from section images */
.content-image img,
.welcome-image {
box-shadow: none !important;
-webkit-box-shadow: none !important; /* For Safari compatibility */
-moz-box-shadow: none !important; /* For Firefox compatibility */
}
/* Ensure no border or other effects interfere */
.content-image,
.modal-image {
box-shadow: none !important;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
}
pull-contents.php (Version 2.83)(Only the script section is updated for brevity; the rest remains as in 2.82)
<script>
document.addEventListener('DOMContentLoaded', function() {
// Synchronize with PHP DEBUG setting
const DEBUG = <?php echo DEBUG ? 'true' : 'false'; ?>;
// Debug log setup
let debugLog = null;
if (DEBUG) {
debugLog = document.createElement('div');
debugLog.id = 'debug-log';
debugLog.style.position = 'fixed';
debugLog.style.bottom = '10px';
debugLog.style.left = '10px';
debugLog.style.background = 'rgba(0, 0, 0, 0.8)';
debugLog.style.color = 'white';
debugLog.style.padding = '10px';
debugLog.style.zIndex = '1000';
debugLog.style.maxHeight = '200px';
debugLog.style.overflowY = 'auto';
document.body.appendChild(debugLog);
}
function logDebug(message, color = 'green') {
if (DEBUG && debugLog) {
debugLog.insertAdjacentHTML('beforeend', `<div style="color: ${color}; font-weight: bold;">Debug: ${message}</div>`);
debugLog.scrollTop = debugLog.scrollHeight;
}
if (DEBUG && console) console.log(`Debug: ${message}`, { color });
}
// Adjust background wrapper height with delayed execution and style logging
function adjustBackground() {
setTimeout(() => {
const wrappers = document.querySelectorAll('.background-image-wrapper');
if (DEBUG) logDebug(`Found ${wrappers.length} background-image-wrapper elements`, wrappers.length > 0 ? 'green' : 'red');
wrappers.forEach(wrapper => {
const parent = wrapper.closest('.column');
const section = parent ? parent.closest('.section-hero--full') : null;
if (section) {
const sectionHeight = section.getBoundingClientRect().height;
const button = section.querySelector('.content__buttons');
const buttonHeight = button ? button.getBoundingClientRect().height : 0;
const totalHeight = sectionHeight + buttonHeight; // Include button height
const separator = section.nextElementSibling;
const sepTop = separator && separator.classList.contains('separator') ? separator.getBoundingClientRect().top : Infinity;
const adjustedHeight = Math.min(totalHeight, sepTop - section.getBoundingClientRect().top - 10); // Subtract 10px buffer
if (adjustedHeight > 0) {
wrapper.style.height = `${adjustedHeight}px`;
const computedStyle = window.getComputedStyle(wrapper);
const bgImage = computedStyle.backgroundImage;
const nextSibling = wrapper.nextSibling;
const hasContentAfter = nextSibling && (nextSibling.nodeType === 1 || nextSibling.nodeType === 3 && nextSibling.textContent.trim());
if (DEBUG) {
logDebug(`Adjusted background wrapper height for parent ${parent.className}: ${adjustedHeight}px, computed height: ${computedStyle.height}`, 'orange');
logDebug(`Computed styles for wrapper: opacity=${computedStyle.opacity}, visibility=${computedStyle.visibility}, display=${computedStyle.display}, z-index=${computedStyle.zIndex}, background-image=${bgImage}`, 'purple');
logDebug(`Content after wrapper: ${hasContentAfter ? 'Yes' : 'No'}, Button height: ${buttonHeight}px, Separator adjustment: ${totalHeight - adjustedHeight}px`, hasContentAfter ? 'green' : 'yellow');
}
} else {
if (DEBUG) logDebug(`Parent ${parent.className} has zero or invalid height`, 'red');
}
} else {
if (DEBUG) logDebug('No parent .column or .section-hero--full found for background wrapper', 'red');
}
});
}, 500); // Delay to ensure DOM and styles are ready
}
if (DEBUG) logDebug('Scheduling background wrapper height adjustment');
adjustBackground();
window.addEventListener('load', adjustBackground);
window.addEventListener('resize', adjustBackground);
// [Rest of the script remains unchanged from Version 2.82]
// ... (renderEmbed, adjustDesktopLayout, openModal, closeModal functions remain the same)
});
</script>
custom.css to 4.31 and pull-contents.php to 2.83..background-image-wrapper’s width: 100% to fill .section-hero--full’s width, aligning with your initial idea.left: 0 and overflow: hidden on .section-hero--full to contain the background.Update Files:
pull-contents.php with Version 2.83 (update the <script> section).custom.css with Version 4.31..section-hero--full structure.Test Background Image:
https://www.nlt-chaplaincy.org/index.html) in both desktop and mobile views..section-hero--full’s width without overflowing or leaving white spaces.Inspect Elements:
.background-image-wrapper:
width is 100% of .section-hero--full and left is 0px.height aligns with the section content plus button, stopping before the .separator..section-hero--full’s overflow: hidden is containing the background.Review Debug Log:
Adjusted background wrapper height messages, including the height values.Next Steps:
.section-hero--full’s width consistently across desktop and mobile, resolving the initial non-extending issue..section-hero--full and .background-image-wrapper dimensions. We might need to adjust padding or add box-sizing to the parent.background-position or add a max-width to .section-hero--full.width: 100%, which should work if .section-hero--full’s width matches the intended content area. If it doesn’t, we may need to inspect Publii’s theme CSS to align it with .main__right.You’re correct that this isn’t as straightforward as a regular CSS fix due to Publii’s dynamic generation and theme constraints. The challenge lies in the theme’s responsive design and nested elements, which require a combination of CSS and script to adapt. We’re on the right track by simplifying back to a CSS-driven width and using the script for height, but we might need to investigate .section-hero--full’s computed width in the theme’s CSS if the issue persists. Let me know the test results, and we can refine further!
In my last reply, I said: //This fix doesn't solve the issues at all. Since the website is in production use, I've reverted it back to V2.70/V4.17 maintain the basic functioning first. With new information from the above work, can you re-evaluate the best method to fix the layout issue from V2.70/V4.17 ? Things to achieve are:
This is the demo of the Publii theme we use for your study: https://demo.getpublii.eu/themes/square/
This is what you said in your previous evaluations:
Re-Evaluation of Fix for V2.70/V4.17Based on the screenshot and description, the alternating wide/narrow sections are caused by inconsistent CSS application: sections with backgrounds get full-width rules (e.g., width: 100vw), while non-background sections remain constrained (e.g., max-width: 1200px), creating the zigzag effect. The overflow onto the left frame occurs because full-width rules shift the z-index or positioning, making content "jump" layers. Truncation happens when content exceeds the constrained parent without proper overflow handling.The Publii Square theme (from the demo) uses a flex-based layout:.main.page is a flex container with display: flex; flex-direction: row;.
.main__left (sidebar) is flex: 0 0 auto; width: ~280px; position: relative; z-index: 1;.
.main__right is flex: 1; max-width: ~64rem; margin: 0 auto; padding: 0 20px; position: relative; z-index: 1;.
Content sections (.post__entry, .container) inherit max-width: 64rem; margin: 0 auto;.
To extend backgrounds without affecting layers, use negative margins on the wrapper only (keeps content in .main__right layer).Best Method:Uniform Width: Set all .section-hero--full to width: 100%; max-width: none; margin: 0; but wrap content in a .section-content div with max-width: 1200px; margin: 0 auto; for consistency.
No Overflow/Same Layer: Apply full-width only to .background-image-wrapper with position: absolute; left: 50%; transform: translateX(-50%); width: 100vw;. This keeps the section in the content layer while the background "breaks out" behind it.
Vertical Extension: Add padding: 15px 0 to .column and adjust wrapper top: -15px; height: calc(100% + 30px); for subtle extension without cutoff.These changes are minimal and targeted to V2.70/V4.17, avoiding broad overrides that could break Publii.
Do you think the context is clear? I think provide the source for you to work on.
.section-hero--full, .post__entry) should align to the same effective width, eliminating the zigzag..main__right layer (no "jumping" onto the sidebar) by applying full-width only to backgrounds, not the content wrappers.My prior evaluation still holds as a solid baseline—it's targeted, minimal, and leverages the theme's flex structure (.main.page as flex row, with .main__left fixed and .main__right flexible). No major re-evaluation needed unless new details emerge, but I'll refine it slightly here for precision.
These are additive styles—add them to your theme's custom CSS (e.g., assets/styles/custom.css in Publii) without overriding core theme files. They build on the Square demo's structure: full-width backgrounds via absolute positioning (to "break out" behind content without shifting layers), uniform content constraints, and padding-based vertical tweaks.
max-width: 1200px (or your theme's equivalent, like 64rem/~1024px) while allowing backgrounds to expand.CSS:
/* Target all section wrappers for uniform content width */
.section-hero--full,
.post__entry,
.container {
width: 100%;
max-width: none; /* Allow full container width */
margin: 0;
position: relative; /* Establishes layering baseline */
}
/* Wrap/force content inside to match theme's max-width */
.section-hero--full .section-content,
.post__entry > .content-wrapper,
.container > div[class*="content"] {
max-width: 1200px; /* Adjust to your theme's exact value, e.g., 64rem */
margin: 0 auto;
padding: 0 20px; /* Matches .main__right padding for alignment */
}
position: absolute + transform to center and expand behind the content (z-index: 0), keeping everything in .main__right's relative layer (z-index: 1). No positioning conflicts with the sidebar.CSS (add to existing background-image rules or a new .background-image-wrapper class):
/* Full-width background without shifting content layer */
.section-hero--full::before,
.background-image-wrapper { /* Or target your specific bg element */
content: ''; /* If pseudo-element; otherwise apply directly */
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
width: 100vw; /* Full viewport width, centered */
height: 100%; /* Matches section height */
z-index: 0; /* Behind content (z-index: 1) */
background-image: url('your-image.jpg'); /* Your existing bg */
background-size: cover;
background-position: center;
}
/* Ensure content stays on top and constrained */
.section-hero--full,
.post__entry {
position: relative;
z-index: 1; /* Keeps content in foreground layer */
overflow: hidden; /* Prevents any bg bleed */
}
.main__left. Tested against Square demo's flex setup—no layer jumps.CSS:
/* Extend background vertically for smoother containment */
.section-hero--full::before,
.background-image-wrapper {
top: -15px; /* Pulls bg up slightly */
height: calc(100% + 30px); /* +30px total extension */
}
/* Add matching padding to section content for balance */
.section-hero--full .column,
.post__entry .column {
padding: 15px 0; /* Vertical padding to "contain" content beautifully */
}
@media (max-width: 768px) { max-width: 100%; })..section-hero--full), swap them in. For the right margin removal, ensure .main__right { margin-right: 0; } is already applied.body overrides that could break Publii's generated pages.vw margins (which ignore flex) or JS hacks.If this doesn't fully resolve (e.g., share a screenshot of the result or your exact CSS file snippet), or if you provide the source code/file you're editing, I can tweak it further. What's your next step—trying this out, or need it in a single CSS block?
pull-contents.php, I can see the structure is solid—the background image wrappers are already in place with the right class names. I'll update it to V2.71 with the layout fixes integrated directly into the PHP output and inline styles. This approach ensures the fixes are applied immediately without requiring separate CSS files, which is perfect for production deployment.Here's the full updated file:
<?php
// pull-contents.php (Version 2.71 - Layout Fixes Integrated)
// Enhanced with uniform section widths, background layer control, and vertical extension
// Debug toggle: Set to true to enable debug messages, false to disable
define('DEBUG', true);
// Define base path for images
define('IMAGE_BASE_PATH', 'https://admin.nlt-chaplaincy.org/images/');
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$config_path = '../config.php';
if (!file_exists($config_path)) {
die("Error: config.php not found at $config_path");
}
require_once $config_path;
if (!isset($dbServer) || !isset($dbUsername) || !isset($dbPassword) || !isset($dbDatabase)) {
die("Error: AppGini database variables not defined in config.php");
}
$conn = new mysqli($dbServer, $dbUsername, $dbPassword, $dbDatabase, $dbPort ?: 3306);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Auto-detect page from calling file if $_GET['page'] not set
if (isset($_GET['page'])) {
$current_page = $_GET['page'];
if (DEBUG) {
echo "<script>document.addEventListener('DOMContentLoaded', function() { logDebug('Page set from GET: \"$current_page\"', 'blue'); });</script>";
}
} else {
$calling_file = basename($_SERVER['SCRIPT_FILENAME']);
$request_uri = $_SERVER['REQUEST_URI'];
if (DEBUG) {
echo "<script>document.addEventListener('DOMContentLoaded', function() { logDebug('Calling file: \"$calling_file\"', 'blue'); logDebug('REQUEST_URI: \"$request_uri\"', 'blue'); });</script>";
}
$current_page = str_replace('.php', '', $calling_file);
if (DEBUG) {
echo "<script>document.addEventListener('DOMContentLoaded', function() { logDebug('Current page after str_replace: \"$current_page\"', 'blue'); });</script>";
}
if ($current_page === 'index') {
$current_page = 'landing';
if (DEBUG) {
echo "<script>document.addEventListener('DOMContentLoaded', function() { logDebug('Current page set to \"landing\"', 'blue'); });</script>";
}
if (preg_match('/\/(task-map)\.php/', $request_uri, $matches)) {
$current_page = $matches[1];
if (DEBUG) {
echo "<script>document.addEventListener('DOMContentLoaded', function() { logDebug('Current page updated from REQUEST_URI: \"$current_page\"', 'blue'); });</script>";
}
}
}
}
$status = 'Show';
// Preload PayPal SDK to support all buttons
$paypalSdkUrl = 'https://www.paypal.com/sdk/js?client-id=AUNZIE2pdhVLgVgUFGEQyyYAJVMuxwkXmCwvslu3c1eR-TMLSvCIBhDZxhhteIoQCTAzJ-50qNcVpuoa&vault=true&intent=subscription';
echo "<script src=\"$paypalSdkUrl\" id=\"paypal-sdk\" async=\"false\" onload=\"console.log('PayPal SDK preloaded')\" onerror=\"console.error('PayPal SDK preload error:', event)\"></script>";
// Inject layout fix CSS for uniform sections and background control
echo '<style>
/* V2.71 Layout Fixes - Uniform Section Widths */
.section-hero--full,
.post__entry,
.container {
width: 100%;
max-width: none;
margin: 0;
position: relative;
z-index: 1;
overflow: hidden;
}
.section-hero--full .section-hero__content,
.section-hero--full .column,
.post__entry > .content-wrapper,
.container > div[class*="content"] {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
position: relative;
z-index: 2;
}
/* Background image layer control - full-width behind content */
.background-image-wrapper {
position: absolute !important;
top: -15px !important;
left: 50% !important;
transform: translateX(-50%) !important;
width: 100vw !important;
height: calc(100% + 30px) !important;
z-index: 0 !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
margin: 0 !important;
padding: 0 !important;
border: none !important;
box-shadow: none !important;
}
/* Ensure content stays above background */
.section-hero--full .column {
position: relative !important;
z-index: 2 !important;
background: rgba(255, 255, 255, 0.95) !important; /* Optional: subtle content backdrop */
padding: 15px 0 !important;
margin: 0 !important;
}
/* Fix for right margin removal - prevent sidebar overlap */
.main__right {
position: relative !important;
z-index: 1 !important;
margin-right: 0 !important;
}
/* Responsive adjustments */
@media (max-width: 768px) {
.section-hero--full .section-hero__content,
.section-hero--full .column {
max-width: 100% !important;
padding: 0 15px !important;
}
.background-image-wrapper {
width: 100vw !important;
left: 50% !important;
transform: translateX(-50%) !important;
}
}
/* Enhanced separator styling for better flow */
.separator {
position: relative;
z-index: 3;
width: 100%;
text-align: center;
padding: 20px 0;
}
</style>';
if (DEBUG) {
echo "<script>document.addEventListener('DOMContentLoaded', function() { logDebug('Final current_page: \"$current_page\"', 'blue'); logDebug('Image Base Path: \"" . IMAGE_BASE_PATH . "\"', 'blue'); logDebug(\"V2.71 Layout fixes loaded\", 'green'); });</script>";
}
// Determine if we're on the stories page
$is_stories_page = ($current_page === 'stories');
// Check if the request is for modal content
$is_modal_request = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') || isset($_GET['modal']);
if (DEBUG) {
echo "<script>document.addEventListener('DOMContentLoaded', function() { logDebug('Is modal request: " . ($is_modal_request ? 'Yes' : 'No') . "', 'blue'); });</script>";
}
$sql = "SELECT id, title, content, code, code_type, image, button_link, button_text, position, model, date_edited, theme_img, img_role, chk_divider
FROM web_content
WHERE page = ? AND status = ?
ORDER BY position ASC, date_edited DESC";
$stmt = $conn->prepare($sql);
if (!$stmt) {
die("Prepare failed: " . $conn->connect_error);
}
$stmt->bind_param("ss", $current_page, $status);
$stmt->execute();
$result = $stmt->get_result();
$sections = [];
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$sections[] = $row;
}
}
if (DEBUG) {
echo "<script>document.addEventListener('DOMContentLoaded', function() { logDebug('Fetched " . count($sections) . " sections for page \"$current_page\"', 'blue'); });</script>";
}
// Group sections by position
$sections_by_position = [];
foreach ($sections as $row) {
$position = $row['position'] ?? 1;
$sections_by_position[$position][] = $row;
}
if (!empty($sections_by_position)) {
ksort($sections_by_position);
$current_index = 0;
foreach ($sections_by_position as $position => $group) {
$current_index++;
$use_default_divider = true;
$has_background_image = false;
$has_paypal = false;
foreach ($group as $row) {
if (!empty($row['theme_img']) && $row['img_role'] === 'Background') {
$has_background_image = true;
$use_default_divider = false;
}
if ($row['code_type'] === 'PayPal') {
$has_paypal = true;
}
}
if (isset($group[0]['chk_divider'])) {
$use_default_divider = $group[0]['chk_divider'] == 1;
}
if ($is_modal_request) {
foreach ($group as $index => $row) {
if (DEBUG) {
echo "<script>document.addEventListener('DOMContentLoaded', function() { logDebug('Rendering modal section ID: {$row['id']} at position: $position', 'blue'); });</script>";
}
echo "<div class=\"modal-story-content\">";
if (!empty($row['title'])) {
echo "<h1 class=\"align-center\">" . $row['title'] . "</h1>";
}
if (!empty($row['image'])) {
$image_url = IMAGE_BASE_PATH . htmlspecialchars($row['image']);
echo "<div class=\"content-image modal-image\"><img src=\"$image_url\" alt=\"Section Image\" class=\"welcome-image\"></div>";
} elseif ($row['model'] === 'title-text-code' || $row['model'] === 'title-text-image-code' && !empty($row['code']) && ($row['code_type'] === 'YouTube' || $row['code_type'] === 'PayPal')) {
echo "<div class=\"content-embed\" id=\"embed-{$row['id']}\"></div>";
}
if (!empty($row['content'])) {
echo "<div class=\"generic-content align-center\">" . $row['content'] . "</div>";
}
if (DEBUG) {
echo "<script>document.addEventListener('DOMContentLoaded', function() { logDebug('Modal content length: " . strlen($row['content']) . " characters', 'purple'); });</script>";
}
echo "</div>";
if ($index < count($group) - 1 || $current_index < count($sections_by_position)) {
echo "<div class=\"modal-section-separator\"></div>";
}
}
} else {
$column_count = min(count($group), 3);
if ($has_paypal) {
$column_count = 1;
}
$extra_class = ($current_page === 'task-map') ? ' task-map-section' : '';
// V2.71: Enhanced section with uniform width and layer control
echo "<section class=\"section-hero section-hero--full layout-$column_count-column $extra_class\" style=\"position: relative; z-index: 1; overflow: hidden;\">";
echo "<div class=\"section-hero__content\" style=\"max-width: 1200px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 2;\">";
usort($group, function($a, $b) {
return strcmp($a['title'], $b['title']);
});
foreach ($group as $index => $row) {
if ($index >= 3 && !$has_paypal) {
continue;
}
// V2.71: Enhanced column with proper layering and padding
echo "<div class=\"column column-$index\" data-model=\"{$row['model']}\" style=\"position: relative; z-index: 2; background: rgba(255, 255, 255, 0.95); padding: 15px 0; margin: 0;\">";
if (!empty($row['theme_img']) && $row['img_role'] === 'Background') {
$background_image = IMAGE_BASE_PATH . htmlspecialchars($row['theme_img']);
// V2.71: Enhanced background wrapper with full-width positioning
echo "<div class=\"background-image-wrapper\" style=\"background-image: url('$background_image'); position: absolute; top: -15px; left: 50%; transform: translateX(-50%); width: 100vw; height: calc(100% + 30px); z-index: 0; background-size: cover; background-position: center; background-repeat: no-repeat; margin: 0; padding: 0;\"></div>";
if (DEBUG) {
echo "<script>document.addEventListener('DOMContentLoaded', function() { logDebug('V2.71 Background image set with full-width positioning: $background_image', 'orange'); });</script>";
}
}
if ($current_page === 'faq') {
echo "<h1 class=\"align-center faq-question\">" . $row['title'] . "</h1>";
echo "<div class=\"generic-content align-center faq-answer\">" . $row['content'] . "</div>";
} else {
echo "<h1 class=\"align-center\">" . $row['title'] . "</h1>";
echo "<div class=\"generic-content align-center\">";
if ($is_stories_page) {
$content = strip_tags($row['content']);
$preview = mb_substr($content, 0, 60, 'UTF-8');
if (mb_strlen($content, 'UTF-8') > 60) {
$preview .= '...';
}
echo htmlspecialchars($preview);
} else {
echo $row['content'];
}
echo "</div>";
}
if ($row['model'] === 'title-text-image-code' || $row['model'] === 'title-text-code') {
if (!empty($row['image']) && $row['model'] === 'title-text-image-code') {
$image_url = IMAGE_BASE_PATH . htmlspecialchars($row['image']);
echo "<div class=\"content-image\"><img src=\"$image_url\" alt=\"Section Image\" class=\"welcome-image\"></div>";
}
if (!empty($row['code']) && ($row['code_type'] === 'YouTube' || $row['code_type'] === 'PayPal')) {
echo "<div class=\"content-embed-container\">";
if ($row['code_type'] === 'PayPal') {
echo "<div class=\"content-embed paypal-embed\" id=\"embed-{$row['id']}\"></div>";
} else {
echo "<div class=\"content-embed\" id=\"embed-{$row['id']}\"></div>";
}
$encodedCode = json_encode($row['code'], JSON_HEX_TAG);
echo "<script>window.contentCode = window.contentCode || []; window.contentCode.push({id: '{$row['id']}', code: " . $encodedCode . ", type: '{$row['code_type']}'});</script>";
if (DEBUG) {
echo "<script>document.addEventListener('DOMContentLoaded', function() { logDebug('Embed code for ID {$row['id']} ({$row['code_type']}): {$row['code']}', 'orange'); });</script>";
}
echo "</div>";
}
} elseif (!empty($row['image']) && $row['model'] !== 'title-text-image-code') {
$image_url = IMAGE_BASE_PATH . htmlspecialchars($row['image']);
echo "<div class=\"content-image\"><img src=\"$image_url\" alt=\"Section Image\" class=\"welcome-image\"></div>";
}
if (!empty($row['button_text'])) {
$button_text = htmlspecialchars($row['button_text']);
echo "<div class=\"content__buttons\">";
if ($is_stories_page) {
$modal_id = 'modal-content-' . $row['id'];
echo "<div id=\"$modal_id\" style=\"display:none;\">";
echo '<div class="modal-story-content">';
if (!empty($row['title'])) {
echo "<h1 class=\"align-center\">" . $row['title'] . "</h1>";
}
if (!empty($row['image'])) {
$image_url = IMAGE_BASE_PATH . htmlspecialchars($row['image']);
echo "<div class=\"content-image modal-image\"><img src=\"$image_url\" alt=\"Section Image\" class=\"welcome-image\"></div>";
} elseif ($row['model'] === 'title-text-code' || $row['model'] === 'title-text-image-code' && ($row['code_type'] === 'YouTube' || $row['code_type'] === 'PayPal')) {
echo "<div class=\"content-embed\" id=\"embed-{$row['id']}\"></div>";
}
if (!empty($row['content'])) {
echo "<div class=\"generic-content align-center\">" . $row['content'] . "</div>";
}
if (DEBUG) {
echo "<script>document.addEventListener('DOMContentLoaded', function() { logDebug('Modal content length: " . strlen($row['content']) . " characters', 'purple'); });</script>";
}
echo '</div>';
echo "</div>";
echo "<a class=\"myButton modal-trigger\" href=\"#\" data-modal-id=\"$modal_id\">$button_text</a>";
if (DEBUG) {
echo "<script>document.addEventListener('DOMContentLoaded', function() { logDebug('Modal trigger rendered for ID: $modal_id with button text: $button_text', 'orange'); });</script>";
}
} else {
$button_link = htmlspecialchars($row['button_link'] ?: '');
if (!empty($button_link) && $row['button_link'] !== '#') {
echo "<a class=\"myButton modal-trigger\" href=\"#\" data-modal-link=\"$button_link\">$button_text</a>";
} else {
echo "<a class=\"myButton\" href=\"#\">$button_text</a>";
}
}
echo "</div>";
}
echo "</div>";
}
echo "</div>";
echo "</section>";
}
if ($current_index < count($sections_by_position) && !$is_modal_request) {
if ($use_default_divider) {
echo "<div class=\"separator\"><img src=\"https://admin.nlt-chaplaincy.org/public/down_arrow.png\" alt=\"Default Separator\" class=\"separator-image\"></div>";
} elseif (!empty($row['theme_img']) && $row['img_role'] === 'Separator') {
$image_url = IMAGE_BASE_PATH . htmlspecialchars($row['theme_img']);
echo "<div class=\"separator\"><img src=\"$image_url\" alt=\"Custom Separator\" class=\"separator-image\"></div>";
}
}
if (DEBUG) {
echo "<script>document.addEventListener('DOMContentLoaded', function() { logDebug('V2.71 Section with position $position rendered successfully with " . count($group) . " items - Uniform layout applied', 'green'); });</script>";
}
}
} else {
echo "No sections found.";
}
// Add custom CSS for PayPal layout fixes (enhanced for V2.71)
if ($current_page === 'landing' && strpos($_SERVER['REQUEST_URI'], 'position-100') !== false) {
echo '<style>';
echo '.main__right .section-hero--full .content-embed-container { display: block !important; width: 100% !important; min-width: 300px !important; max-width: 300px !important; margin: 0 auto !important; text-align: center !important; position: relative !important; left: 0 !important; transform: none !important; z-index: 3 !important; }';
echo '.main__right .section-hero--full .paypal-embed { width: 100% !important; min-width: 300px !important; max-width: 300px !important; margin: 0 auto !important; text-align: center !important; overflow: visible !important; position: relative !important; z-index: 3 !important; }';
echo '.main__right .section-hero--full .paypal-embed .paypal-buttons, .main__right .section-hero--full .paypal-embed iframe { width: 100% !important; min-width: 300px !important; max-width: 300px !important; margin: 0 auto !important; box-sizing: border-box !important; border: none !important; outline: none !important; position: relative !important; z-index: 3 !important; }';
echo '</style>';
}
// Modal container (only for non-AJAX requests)
if (!$is_modal_request) {
echo '<div id="story-modal" class="modal">';
echo '<div class="modal-content">';
echo '<span class="modal-close">×</span>';
echo '<div id="modal-body"></div>';
echo '</div>';
echo '</div>';
}
$stmt->close();
$conn->close();
?>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Synchronize with PHP DEBUG setting
const DEBUG = <?php echo DEBUG ? 'true' : 'false'; ?>;
// Debug log setup
let debugLog = null;
if (DEBUG) {
debugLog = document.createElement('div');
debugLog.id = 'debug-log';
debugLog.style.position = 'fixed';
debugLog.style.bottom = '10px';
debugLog.style.left = '10px';
debugLog.style.background = 'rgba(0, 0, 0, 0.8)';
debugLog.style.color = 'white';
debugLog.style.padding = '10px';
debugLog.style.zIndex = '1000';
debugLog.style.maxHeight = '400px';
debugLog.style.overflowY = 'auto';
debugLog.style.fontSize = '12px';
document.body.appendChild(debugLog);
}
function logDebug(message, color = 'green') {
if (DEBUG && debugLog) {
debugLog.insertAdjacentHTML('beforeend', `<div style="color: ${color}; font-weight: bold; margin: 2px 0;">Debug: ${message}</div>`);
debugLog.scrollTop = debugLog.scrollHeight;
}
if (DEBUG && console) console.log(`Debug: ${message}`, { color });
}
// V2.71 Enhanced background wrapper debugging and adjustment
function adjustBackgroundHeight() {
setTimeout(() => {
const wrappers = document.querySelectorAll('.background-image-wrapper');
if (DEBUG) logDebug(`V2.71 Found ${wrappers.length} background-image-wrapper elements with full-width positioning`, wrappers.length > 0 ? 'green' : 'red');
wrappers.forEach((wrapper, index) => {
const parent = wrapper.closest('.column');
if (parent) {
const parentRect = parent.getBoundingClientRect();
const parentHeight = parentRect.height;
if (parentHeight > 0) {
// V2.71: Ensure proper full-width positioning
const computedStyle = window.getComputedStyle(wrapper);
const currentLeft = parseFloat(computedStyle.left) || 0;
const currentTransform = computedStyle.transform;
// Apply/verify full-width positioning if not already set
if (Math.abs(currentLeft - 50) > 1 || !currentTransform.includes('translateX(-50%)')) {
wrapper.style.position = 'absolute';
wrapper.style.top = '-15px';
wrapper.style.left = '50%';
wrapper.style.transform = 'translateX(-50%)';
wrapper.style.width = '100vw';
wrapper.style.height = `calc(100% + 30px)`;
wrapper.style.zIndex = '0';
if (DEBUG) logDebug(`V2.71 Applied full-width positioning to wrapper ${index}`, 'orange');
}
wrapper.style.height = `${parentHeight + 30}px`;
const bgImage = computedStyle.backgroundImage;
const inlineStyle = wrapper.style.backgroundImage;
const wrapperId = `wrapper-${index}`;
wrapper.setAttribute('data-debug-id', wrapperId);
if (DEBUG) {
logDebug(`=== V2.71 Background Wrapper ${index} Debug ===`, 'purple');
logDebug(`Parent: ${parent.className}, Height: ${parentHeight.toFixed(2)}px, Position: ${parentRect.left.toFixed(2)}px`, 'blue');
logDebug(`Wrapper positioning - left: ${currentLeft}%, transform: ${currentTransform}`, 'orange');
logDebug(`Computed height: ${computedStyle.height}, Set height: ${wrapper.style.height}`, 'green');
logDebug(`Inline style background-image: "${inlineStyle}"`, inlineStyle ? 'green' : 'red');
logDebug(`Computed style background-image: "${bgImage}"`, bgImage && bgImage !== 'none' ? 'green' : 'red');
logDebug(`Wrapper layer - z-index: ${computedStyle.zIndex}, position: ${computedStyle.position}`, 'purple');
// Test image loading if background image is set
if (bgImage && bgImage !== 'none' && bgImage !== 'initial' && bgImage !== 'inherit') {
try {
const urlMatch = bgImage.match(/url\(["']?([^"']+)["']?\)/);
if (urlMatch && urlMatch[1]) {
const imgUrl = urlMatch[1];
const img = new Image();
img.src = imgUrl;
img.onload = () => logDebug(`✅ Background image LOADED: ${imgUrl.substring(imgUrl.lastIndexOf('/') + 1)}`, 'green');
img.onerror = () => logDebug(`❌ Background image FAILED: ${imgUrl.substring(imgUrl.lastIndexOf('/') + 1)}`, 'red');
img.onabort = () => logDebug(`⚠️ Background image ABORTED: ${imgUrl.substring(imgUrl.lastIndexOf('/') + 1)}`, 'yellow');
}
} catch (error) {
logDebug(`❌ Error testing image load: ${error.message}`, 'red');
}
}
logDebug(`=== End V2.71 Debug ===`, 'purple');
}
} else {
if (DEBUG) logDebug(`Parent ${parent.className} has zero height - retrying`, 'yellow');
setTimeout(() => adjustBackgroundHeight(), 100);
}
} else {
if (DEBUG) logDebug('No parent .column found for background wrapper', 'red');
}
});
// V2.71: Verify uniform section widths
const sections = document.querySelectorAll('.section-hero--full');
if (sections.length > 0 && DEBUG) {
const widths = Array.from(sections).map(s => {
const rect = s.getBoundingClientRect();
return `${s.className}: ${rect.width.toFixed(0)}px`;
});
logDebug(`V2.71 Section widths - Uniform: ${widths.join(', ')}`, widths.every(w => w.includes('1200px') || w.includes('100vw')) ? 'green' : 'yellow');
}
}, 500);
}
if (DEBUG) logDebug('V2.71 Scheduling enhanced background wrapper adjustment');
adjustBackgroundHeight();
window.addEventListener('load', adjustBackgroundHeight);
window.addEventListener('resize', adjustBackgroundHeight);
if (DEBUG) logDebug('Modal script loaded');
const modal = document.getElementById('story-modal');
const modalBody = document.getElementById('modal-body');
const closeBtn = document.querySelector('.modal-close');
const triggers = document.querySelectorAll('.modal-trigger');
if (DEBUG) logDebug('Found ' + triggers.length + ' modal triggers');
// Verify PayPal and modal functionality
triggers.forEach(trigger => {
trigger.addEventListener('click', function(e) {
if (DEBUG) logDebug(`Modal trigger clicked: ${this.getAttribute('data-modal-id') || this.getAttribute('data-modal-link')}`, 'green');
});
});
document.querySelectorAll('.paypal-embed').forEach(embed => {
if (DEBUG) logDebug(`PayPal embed found: ${embed.id}`, 'green');
});
// Function to render embed blocks with dynamic delay
function renderEmbed(item, index, total) {
const container = document.getElementById(`embed-${item.id}`);
if (!container) {
if (DEBUG) logDebug(`Container not found for embed ID ${item.id}`, 'red');
return;
}
const divMatch = item.code.match(/<div\s+[^>]*id="[^"]+"[^>]*>/i);
const buttonMatch = item.code.match(/<script>\s*paypal\.Buttons\([\s\S]*?\)\.render\(['"][^'"]+['"]\);\s*<\/script>/i);
if (DEBUG) {
logDebug(`Div match for ID ${item.id}: ${divMatch ? 'Success' : 'Failed'}`, divMatch ? 'green' : 'red');
logDebug(`Button match for ID ${item.id}: ${buttonMatch ? 'Success' : 'Failed'}`, buttonMatch ? 'green' : 'red');
if (buttonMatch) logDebug(`Button script content for ID ${item.id}: ${buttonMatch[0]}`, 'orange');
}
if (item.type === 'PayPal' && divMatch && buttonMatch) {
const uniqueId = `paypal-button-container-${item.id}`;
let divContent = divMatch[0].replace(/id="[^"]+"/, `id="${uniqueId}"`);
container.innerHTML = divContent;
container.querySelector(`#${uniqueId}`).style.cssText = 'width: 100% !important; min-width: 300px !important; max-width: 300px !important; margin: 0 auto !important; position: relative !important; z-index: 3 !important;';
if (DEBUG) logDebug(`V2.71 Inserted div for PayPal ID ${item.id} with enhanced z-index`, 'orange');
function waitForSDK(callback) {
if (typeof paypal !== 'undefined') {
if (DEBUG) logDebug(`PayPal SDK available for ID ${item.id}`, 'green');
callback();
} else {
if (DEBUG) logDebug(`Checking SDK for ID ${item.id}, status: ${typeof paypal}`, 'yellow');
setTimeout(() => waitForSDK(callback), 100);
}
}
waitForSDK(() => {
let scriptContent = buttonMatch[0].replace(/^<script>|<\/script>$/g, '').trim();
scriptContent = scriptContent.replace(/\.render\(['"][^'"]+['"]\)/, `.render('#${uniqueId}')`);
const uniqueScript = `(function() { var paypalInstance = paypal.Buttons; ${scriptContent} })();`;
const buttonScript = document.createElement('script');
buttonScript.textContent = uniqueScript;
document.body.appendChild(buttonScript);
if (DEBUG) logDebug(`Injected unique button script for ID ${item.id}`, 'orange');
const dynamicDelay = index * 1500 + (total * 500);
setTimeout(() => {
const paypalButtons = document.querySelectorAll(`#${uniqueId} .paypal-buttons`);
const paypalIframes = document.querySelectorAll(`#${uniqueId} iframe`);
if (DEBUG) logDebug(`Found ${paypalButtons.length} button(s) and ${paypalIframes.length} iframe(s) for ID ${item.id} after ${dynamicDelay}ms`, paypalButtons.length > 0 ? 'green' : 'red');
paypalButtons.forEach((button, btnIndex) => {
const iframe = paypalIframes[btnIndex];
if (button && iframe) {
button.style.cssText += 'width: 100% !important; min-width: 300px !important; max-width: 300px !important; margin: 0 auto !important; border: none !important; outline: none !important; display: block !important; position: relative !important; z-index: 3 !important;';
iframe.style.cssText += 'width: 100% !important; min-width: 300px !important; max-width: 300px !important; margin: 0 auto !important; border: none !important; outline: none !important; display: block !important; position: relative !important; z-index: 3 !important;';
if (DEBUG) {
const style = window.getComputedStyle(button);
logDebug(`V2.71 Computed style for button ${uniqueId} (index ${btnIndex}): width=${style.width}, z-index=${style.zIndex}, position=${style.position}`, 'purple');
}
} else if (DEBUG) {
logDebug(`Button or iframe not found for ID ${item.id} at index ${btnIndex}`, 'red');
}
});
}, dynamicDelay);
});
} else if (item.type === 'YouTube') {
container.innerHTML = item.code;
container.style.display = 'block';
if (DEBUG) logDebug(`Rendered YouTube embed for ID ${item.id}`, 'orange');
} else {
container.innerHTML = `<div class="embed-fallback" id="fallback-${item.id}">${item.code}</div>`;
container.style.display = 'block';
if (DEBUG) logDebug(`Fallback rendered for ID ${item.id} (parsing failed, scripts not executed)`, 'red');
}
}
if (window.contentCode && Array.isArray(window.contentCode)) {
window.contentCode.forEach((item, index) => {
renderEmbed(item, index, window.contentCode.length);
});
} else if (DEBUG) {
logDebug('contentCode is not an array or unavailable', 'red');
}
function adjustDesktopLayout() {
if (window.innerWidth >= 1024) {
const embedContainers = document.querySelectorAll('.main__right .section-hero--full .content-embed-container');
embedContainers.forEach(container => {
container.style.margin = '0 auto !important';
container.style.position = 'relative !important';
container.style.zIndex = '3 !important';
if (DEBUG) logDebug(`V2.71 Adjusted desktop container centering for ${container.querySelector('.paypal-embed')?.id}`, 'blue');
});
}
}
window.addEventListener('load', adjustDesktopLayout);
window.addEventListener('resize', adjustDesktopLayout);
function openModal(content) {
const tempDiv = document.createElement('div');
tempDiv.innerHTML = content;
const backgroundWrappers = tempDiv.querySelectorAll('.background-image-wrapper');
backgroundWrappers.forEach(wrapper => wrapper.remove());
const buttons = tempDiv.querySelectorAll('.content__buttons');
buttons.forEach(button => button.remove());
const debugMessages = tempDiv.querySelectorAll('div[style*="color: purple"], div[style*="color: blue"], div[style*="color: red"], div[style*="color: green"]');
debugMessages.forEach(msg => msg.remove());
let combinedContent = '';
const sections = tempDiv.querySelectorAll('.modal-story-content');
if (DEBUG) logDebug('Found ' + sections.length + ' modal-story-content sections');
if (sections.length > 0) {
sections.forEach((section, index) => {
combinedContent += section.outerHTML.trim();
if (index < sections.length - 1) {
combinedContent += '<div class="modal-section-separator"></div>';
}
});
} else {
const fallbackSections = tempDiv.querySelectorAll('.section-hero__content');
if (DEBUG) logDebug('Found ' + fallbackSections.length + ' section-hero__content sections');
if (fallbackSections.length > 0) {
fallbackSections.forEach((section, index) => {
const title = section.querySelector('h1');
const image = section.querySelector('.content-image');
const content = section.querySelector('.generic-content');
const newContent = document.createElement('div');
newContent.className = 'modal-story-content';
if (title) newContent.appendChild(title.cloneNode(true));
if (image) newContent.appendChild(image.cloneNode(true));
if (content) newContent.appendChild(content.cloneNode(true));
combinedContent += newContent.outerHTML.trim();
if (index < fallbackSections.length - 1) {
combinedContent += '<div class="modal-section-separator"></div>';
}
});
} else {
const genericContent = tempDiv.querySelector('.generic-content');
if (genericContent) {
if (DEBUG) logDebug('Falling back to .generic-content');
const newContent = document.createElement('div');
newContent.className = 'modal-story-content';
newContent.appendChild(genericContent.cloneNode(true));
combinedContent = newContent.outerHTML.trim();
} else {
if (DEBUG) logDebug('No content found in .modal-story-content, .section-hero__content, or .generic-content', 'red');
combinedContent = '<p>Content could not be parsed from the page.</p>';
}
}
}
modalBody.innerHTML = combinedContent;
modal.style.display = 'block';
modal.setAttribute('aria-hidden', 'false');
if (modalBody.children.length > 0 && closeBtn) {
closeBtn.focus();
}
if (DEBUG) logDebug('Modal opened');
}
function closeModal() {
modal.style.display = 'none';
modal.setAttribute('aria-hidden', 'true');
modalBody.innerHTML = '';
if (DEBUG && debugLog) {
debugLog.innerHTML = '';
}
if (DEBUG) logDebug('Modal closed');
}
if (modal && modalBody && closeBtn && triggers) {
triggers.forEach(trigger => {
trigger.addEventListener('click', function(e) {
e.preventDefault();
const modalId = this.getAttribute('data-modal-id');
if (modalId) {
const contentDiv = document.getElementById(modalId);
if (contentDiv) {
const content = contentDiv.innerHTML;
if (DEBUG) logDebug('Stories modal triggered, content from ID: ' + modalId);
if (DEBUG) logDebug('Modal content length: ' + content.length + ' characters', 'purple');
openModal(content);
} else {
openModal('<p>Content not found.</p>');
if (DEBUG) logDebug('Modal content not found for ID: ' + modalId, 'red');
}
return;
}
const link = this.getAttribute('data-modal-link');
if (DEBUG) logDebug('Trigger clicked, link: ' + link);
if (!link || link === '#' || link.includes('index.php')) {
openModal('<p>This link cannot be loaded in a modal to prevent recursive loading.</p>');
return;
}
let basePath = window.location.origin;
let absoluteLink;
try {
if (link.startsWith('http://') || link.startsWith('https://')) {
absoluteLink = link;
} else if (link.startsWith('/')) {
absoluteLink = new URL(link, window.location.origin).href;
} else {
absoluteLink = new URL(link, window.location.origin + '/').href;
}
absoluteLink += (absoluteLink.includes('?') ? '&' : '?') + 'modal=1';
if (DEBUG) logDebug('Fetching absolute link: ' + absoluteLink);
} catch (error) {
if (DEBUG) logDebug('URL construction error: ' + error.message, 'red');
openModal('<p>Invalid URL format.</p>');
return;
}
openModal('<p>Loading...</p>');
fetch(absoluteLink, {
headers: {
'X-Requested-With': 'XMLHttpRequest'
}
})
.then(response => {
if (DEBUG) logDebug('Fetch response status: ' + response.status + ' ' + response.statusText);
if (!response.ok) {
throw new Error('Network response was not ok: ' + response.statusText);
}
return response.text();
})
.then(data => {
if (DEBUG) logDebug('Fetched HTML length: ' + data.length);
const parser = new DOMParser();
const doc = parser.parseFromString(data, 'text/html');
let combinedContent = '';
const sections = doc.querySelectorAll('.modal-story-content');
if (DEBUG) logDebug('Found ' + sections.length + ' modal-story-content sections in fetched content');
if (sections.length > 0) {
sections.forEach((content, index) => {
combinedContent += content.outerHTML.trim();
if (index < sections.length - 1) {
combinedContent += '<div class="modal-section-separator"></div>';
}
});
} else {
const fallbackSections = doc.querySelectorAll('.section-hero__content');
if (DEBUG) logDebug('Found ' + fallbackSections.length + ' section-hero__content sections');
if (fallbackSections.length > 0) {
fallbackSections.forEach((section, index) => {
const title = section.querySelector('h1');
const image = section.querySelector('.content-image');
const content = section.querySelector('.generic-content');
const newContent = document.createElement('div');
newContent.className = 'modal-story-content';
if (title) newContent.appendChild(title.cloneNode(true));
if (image) newContent.appendChild(image.cloneNode(true));
if (content) newContent.appendChild(content.cloneNode(true));
combinedContent += newContent.outerHTML.trim();
if (index < fallbackSections.length - 1) {
combinedContent += '<div class="modal-section-separator"></div>';
}
});
} else {
const genericContent = doc.querySelector('.generic-content');
if (genericContent) {
if (DEBUG) logDebug('Falling back to .generic-content');
const newContent = document.createElement('div');
newContent.className = 'modal-story-content';
newContent.appendChild(genericContent.cloneNode(true));
combinedContent = newContent.outerHTML.trim();
} else {
if (DEBUG) logDebug('No content found in .modal-story-content, .section-hero__content, or .generic-content', 'red');
combinedContent = '<p>Content could not be parsed from the page.</p>';
}
}
}
if (combinedContent) {
openModal(combinedContent);
} else {
openModal('<p>No content found.</p>');
}
})
.catch(error => {
if (DEBUG) logDebug('Fetch error: ' + error.message, 'red');
openModal('<p>Sorry, the content could not be loaded: ' + error.message + '</p>');
});
});
});
closeBtn.addEventListener('click', closeModal);
window.addEventListener('click', function(event) {
if (event.target === modal) {
closeModal();
}
});
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape' && modal.style.display === 'block') {
closeModal();
}
});
} else {
if (DEBUG) logDebug('Modal elements missing (modal, modalBody, closeBtn, or triggers)', 'red');
}
// V2.71: Final layout verification
if (DEBUG) {
setTimeout(() => {
const mainRight = document.querySelector('.main__right');
const sections = document.querySelectorAll('.section-hero--full');
if (mainRight && sections.length > 0) {
const mainRightRect = mainRight.getBoundingClientRect();
const firstSectionRect = sections[0].getBoundingClientRect();
logDebug(`V2.71 Layout verification - Main right: ${mainRightRect.width.toFixed(0)}px, First section: ${firstSectionRect.width.toFixed(0)}px, Overlap: ${Math.abs(mainRightRect.left - firstSectionRect.left) < 5 ? 'None' : 'Detected'}`, 'green');
}
}, 1000);
}
});
</script>
.section-hero--full, .post__entry, and .container to ensure all sections use width: 100%; max-width: none.section-hero__content, .column) now constrained to max-width: 1200px; margin: 0 auto.background-image-wrapper now uses position: absolute; left: 50%; transform: translateX(-50%); width: 100vw; z-index: 0.column, .section-hero__content) set to position: relative; z-index: 2.main__right explicitly set to position: relative; z-index: 1 to maintain proper stackingheight: calc(100% + 30px) with top: -15px for +15px top/bottom extensionpadding: 15px 0 to balance the extended backgroundbackground: rgba(255, 255, 255, 0.95) to content for better readability over imagesleft: 50% and transform: translateX(-50%) application100vw backgrounds work on all screen sizesTest this in your Publii preview first—the changes should eliminate the zigzag layout, keep backgrounds full-width without content overflow, and provide smooth vertical extension. The debug logs will show exactly what's happening with positioning and layering.
Ready for the CSS file next, or want to test this first and share results?
This fix makes things much more worse. First of all, the site logo get moved behind the left frame. Secondly, the left frame is now shown only at the top of the desktop view but now running down the entire website, with the right content frame now comes AFTER the left frame taking the entire width of the browser. Then, the section background images are now covering the section content with only the action button showing. ', 'orange'); }); are still showing under the PayPal button.
Before testing in details, I want to ensure if this fix is following the insights from studying the sample Publii theme at https://demo.getpublii.eu/themes/square/? Having applied just the PHP, I still see ', 'orange'); }); appearing.
Hey, I think I've found out why we've failed to fix the debug message leakage issue for so long: I've been replacing the wrong files on the server!! After some trials and error, I found V2.67 of the PHP and V4.17 of the CSS together can return the website to a more workable state to re-start our bug fix work.The goals are still the same:Extend the section background images to contain the title and action buttons more aesthetically To remove the left (very small) and right content margin (very big) on desktop (always shows margin now) and mobile views (Can see margins in some widths), observing the structure of the Publii theme No Zig Zag in dynamic sections content width (See previous chats if you can't recall this) No mess up of Z-index when doing the above Maintain existing logic on PayPal button display and single-column-only layout Maintain existing logic on modal pop-up display (No background images inside modal) Maintain existing logic on dynamic section rendering (Single and multi-column)
Below are the current source code versions:
<?php
// pull-contents.php (Version 2.67)
// Debug toggle: Set to true to enable debug messages, false to disable
define('DEBUG', true); // Keep enabled for troubleshooting
// Define base path for images
define('IMAGE_BASE_PATH', 'https://admin.nlt-chaplaincy.org/images/');
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$config_path = '../config.php';
if (!file_exists($config_path)) {
die("Error: config.php not found at $config_path");
}
require_once $config_path;
if (!isset($dbServer) || !isset($dbUsername) || !isset($dbPassword) || !isset($dbDatabase)) {
die("Error: AppGini database variables not defined in config.php");
}
$conn = new mysqli($dbServer, $dbUsername, $dbPassword, $dbDatabase, $dbPort ?: 3306);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Auto-detect page from calling file if $_GET['page'] not set
if (isset($_GET['page'])) {
$current_page = $_GET['page'];
if (DEBUG) {
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Page set from GET: '$current_page'</div>";
}
} else {
$calling_file = basename($_SERVER['SCRIPT_FILENAME']);
$request_uri = $_SERVER['REQUEST_URI'];
if (DEBUG) {
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Calling file: '$calling_file'</div>";
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: REQUEST_URI: '$request_uri'</div>";
}
$current_page = str_replace('.php', '', $calling_file);
if (DEBUG) {
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Current page after str_replace: '$current_page'</div>";
}
if ($current_page === 'index') {
$current_page = 'landing';
if (DEBUG) {
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Current page set to 'landing'</div>";
}
if (preg_match('/\/(task-map)\.php/', $request_uri, $matches)) {
$current_page = $matches[1];
if (DEBUG) {
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Current page updated from REQUEST_URI: '$current_page'</div>";
}
}
}
}
$status = 'Show';
// Preload PayPal SDK to support all buttons
$paypalSdkUrl = 'https://www.paypal.com/sdk/js?client-id=AUNZIE2pdhVLgVgUFGEQyyYAJVMuxwkXmCwvslu3c1eR-TMLSvCIBhDZxhhteIoQCTAzJ-50qNcVpuoa&vault=true&intent=subscription';
echo "<script src=\"$paypalSdkUrl\" id=\"paypal-sdk\" async=\"false\" onload=\"console.log('PayPal SDK preloaded')\" onerror=\"console.error('PayPal SDK preload error:', event)\"></script>";
if (DEBUG) {
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Final current_page: '$current_page'</div>";
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Image Base Path: '" . IMAGE_BASE_PATH . "'</div>";
}
// Determine if we're on the stories page
$is_stories_page = ($current_page === 'stories');
// Check if the request is for modal content
$is_modal_request = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') || isset($_GET['modal']);
if (DEBUG) {
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Is modal request: " . ($is_modal_request ? 'Yes' : 'No') . "</div>";
}
$sql = "SELECT id, title, content, code, code_type, image, button_link, button_text, position, model, date_edited, theme_img, img_role, chk_divider
FROM web_content
WHERE page = ? AND status = ?
ORDER BY position ASC, date_edited DESC";
$stmt = $conn->prepare($sql);
if (!$stmt) {
die("Prepare failed: " . $conn->connect_error);
}
$stmt->bind_param("ss", $current_page, $status);
$stmt->execute();
$result = $stmt->get_result();
$sections = [];
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$sections[] = $row;
}
}
if (DEBUG) {
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Fetched " . count($sections) . " sections for page '$current_page'</div>";
}
// Group sections by position
$sections_by_position = [];
foreach ($sections as $row) {
$position = $row['position'] ?? 1;
$sections_by_position[$position][] = $row;
}
if (!empty($sections_by_position)) {
ksort($sections_by_position);
$current_index = 0;
foreach ($sections_by_position as $position => $group) {
$current_index++;
$use_default_divider = true;
$has_background_image = false;
$has_paypal = false;
foreach ($group as $row) {
if (!empty($row['theme_img']) && $row['img_role'] === 'Background') {
$has_background_image = true;
$use_default_divider = false;
}
if ($row['code_type'] === 'PayPal') {
$has_paypal = true;
}
}
if (isset($group[0]['chk_divider'])) {
$use_default_divider = $group[0]['chk_divider'] == 1;
}
if ($is_modal_request) {
foreach ($group as $index => $row) {
if (DEBUG) {
echo "<div style='color: blue; font-weight: bold; text-align: center;'>Debug: Rendering modal section ID: {$row['id']} at position: $position</div>";
}
echo "<div class=\"modal-story-content\">";
if (!empty($row['title'])) {
echo "<h1 class=\"align-center\">" . $row['title'] . "</h1>";
}
if (!empty($row['image'])) {
$image_url = IMAGE_BASE_PATH . htmlspecialchars($row['image']);
echo "<div class=\"content-image modal-image\"><img src=\"$image_url\" alt=\"Section Image\" class=\"welcome-image\"></div>";
} elseif ($row['model'] === 'title-text-code' || $row['model'] === 'title-text-image-code' && !empty($row['code']) && ($row['code_type'] === 'YouTube' || $row['code_type'] === 'PayPal')) {
echo "<div class=\"content-embed\" id=\"embed-{$row['id']}\"></div>";
}
if (!empty($row['content'])) {
echo "<div class=\"generic-content align-center\">" . $row['content'] . "</div>";
}
if (DEBUG) {
echo "<div style='color: purple; font-weight: bold; text-align: center;'>Debug: Modal content length: " . strlen($row['content']) . " characters</div>";
}
echo "</div>";
if ($index < count($group) - 1 || $current_index < count($sections_by_position)) {
echo "<div class=\"modal-section-separator\"></div>";
}
}
} else {
$column_count = min(count($group), 3);
if ($has_paypal) {
$column_count = 1; // Force single-column for sections with PayPal
}
$extra_class = ($current_page === 'task-map') ? ' task-map-section' : '';
echo "<section class=\"section-hero section-hero--full layout-$column_count-column $extra_class\">";
echo "<div class=\"section-hero__content\">";
// Sort by title for mobile view
usort($group, function($a, $b) {
return strcmp($a['title'], $b['title']);
});
foreach ($group as $index => $row) {
if ($index >= 3 && !$has_paypal) {
continue; // Hide sections beyond the third column on desktop for non-PP
}
echo "<div class=\"column column-$index\">";
if (!empty($row['theme_img']) && $row['img_role'] === 'Background') {
$background_image = IMAGE_BASE_PATH . htmlspecialchars($row['theme_img']);
echo "<div class=\"background-image-wrapper\" style=\"background-image: url('$background_image');\"></div>";
if (DEBUG) {
echo "<div style='color: orange; font-weight: bold; text-align: center;'>Debug: Background image set to: $background_image | Wrapper height: " . (isset($computedHeight) ? $computedHeight : 'N/A') . "px</div>";
}
}
if ($current_page === 'faq') {
echo "<h1 class=\"align-center faq-question\">" . $row['title'] . "</h1>";
echo "<div class=\"generic-content align-center faq-answer\">" . $row['content'] . "</div>";
} else {
echo "<h1 class=\"align-center\">" . $row['title'] . "</h1>";
echo "<div class=\"generic-content align-center\">";
if ($is_stories_page) {
$content = strip_tags($row['content']);
$preview = mb_substr($content, 0, 60, 'UTF-8');
if (mb_strlen($content, 'UTF-8') > 60) {
$preview .= '...';
}
echo htmlspecialchars($preview);
} else {
echo $row['content'];
}
echo "</div>";
}
if ($row['model'] === 'title-text-image-code' || $row['model'] === 'title-text-code') {
if (!empty($row['image']) && $row['model'] === 'title-text-image-code') {
$image_url = IMAGE_BASE_PATH . htmlspecialchars($row['image']);
echo "<div class=\"content-image\"><img src=\"$image_url\" alt=\"Section Image\" class=\"welcome-image\"></div>";
}
if (!empty($row['code']) && ($row['code_type'] === 'YouTube' || $row['code_type'] === 'PayPal')) {
echo "<div class=\"content-embed-container\">";
if ($row['code_type'] === 'PayPal') {
echo "<div class=\"content-embed paypal-embed\" id=\"embed-{$row['id']}\"></div>";
} else {
echo "<div class=\"content-embed\" id=\"embed-{$row['id']}\"></div>";
}
$encodedCode = json_encode($row['code'], JSON_HEX_TAG);
echo "<script>window.contentCode = window.contentCode || []; window.contentCode.push({id: '{$row['id']}', code: " . $encodedCode . ", type: '{$row['code_type']}'});</script>";
if (DEBUG) {
echo "<div style='color: orange; display: none;'>Debug: Embed code for ID ${row['id']} (${row['code_type']}): ${row['code']}</div>";
}
echo "</div>";
}
} elseif (!empty($row['image']) && $row['model'] !== 'title-text-image-code') {
$image_url = IMAGE_BASE_PATH . htmlspecialchars($row['image']);
echo "<div class=\"content-image\"><img src=\"$image_url\" alt=\"Section Image\" class=\"welcome-image\"></div>";
}
if (!empty($row['button_text'])) {
$button_text = htmlspecialchars($row['button_text']);
echo "<div class=\"content__buttons\">";
if ($is_stories_page) {
$modal_id = 'modal-content-' . $row['id'];
echo "<div id=\"$modal_id\" style=\"display:none;\">";
echo '<div class="modal-story-content">';
if (!empty($row['title'])) {
echo "<h1 class=\"align-center\">" . $row['title'] . "</h1>";
}
if (!empty($row['image'])) {
$image_url = IMAGE_BASE_PATH . htmlspecialchars($row['image']);
echo "<div class=\"content-image modal-image\"><img src=\"$image_url\" alt=\"Section Image\" class=\"welcome-image\"></div>";
} elseif ($row['model'] === 'title-text-code' || $row['model'] === 'title-text-image-code' && ($row['code_type'] === 'YouTube' || $row['code_type'] === 'PayPal')) {
echo "<div class=\"content-embed\" id=\"embed-{$row['id']}\"></div>";
}
if (!empty($row['content'])) {
echo "<div class=\"generic-content align-center\">" . $row['content'] . "</div>";
}
if (DEBUG) {
echo "<div style='color: purple; font-weight: bold; text-align: center;'>Debug: Modal content length: " . strlen($row['content']) . " characters</div>";
}
echo '</div>';
echo "</div>";
echo "<a class=\"myButton modal-trigger\" href=\"#\" data-modal-id=\"$modal_id\">$button_text</a>";
if (DEBUG) {
echo "<div style='color: orange; font-weight: bold; text-align: center;'>Debug: Modal trigger rendered for ID: $modal_id with button text: $button_text</div>";
}
} else {
$button_link = htmlspecialchars($row['button_link'] ?: '');
if (!empty($button_link) && $row['button_link'] !== '#') {
echo "<a class=\"myButton modal-trigger\" href=\"#\" data-modal-link=\"$button_link\">$button_text</a>";
} else {
echo "<a class=\"myButton\" href=\"#\">$button_text</a>";
}
}
echo "</div>";
}
echo "</div>";
}
echo "</div>";
echo "</section>";
}
if ($current_index < count($sections_by_position) && !$is_modal_request) {
if ($use_default_divider) {
echo "<div class=\"separator\"><img src=\"https://admin.nlt-chaplaincy.org/public/down_arrow.png\" alt=\"Default Separator\" class=\"separator-image\"></div>";
} elseif (!empty($row['theme_img']) && $row['img_role'] === 'Separator') {
$image_url = IMAGE_BASE_PATH . htmlspecialchars($row['theme_img']);
echo "<div class=\"separator\"><img src=\"$image_url\" alt=\"Custom Separator\" class=\"separator-image\"></div>";
}
}
if (DEBUG) {
echo "<div style=\"color: green; font-weight: bold; text-align: center;\">Debug: Section with position $position rendered successfully with " . count($group) . " items.</div>";
}
}
} else {
echo "No sections found.";
}
// Add custom CSS for layout fixes (minimal inline, move to custom.css where possible)
if ($current_page === 'landing' && strpos($_SERVER['REQUEST_URI'], 'position-100') !== false) {
echo '<style>';
echo '.main__right .section-hero--full .content-embed-container { display: block !important; width: 100% !important; min-width: 300px !important; max-width: 300px !important; margin: 0 auto !important; text-align: center !important; position: relative !important; left: 0 !important; transform: none !important; }';
echo '.main__right .section-hero--full .paypal-embed { width: 100% !important; min-width: 300px !important; max-width: 300px !important; margin: 0 auto !important; text-align: center !important; overflow: visible !important; }';
echo '.main__right .section-hero--full .paypal-embed .paypal-buttons, .main__right .section-hero--full .paypal-embed iframe { width: 100% !important; min-width: 300px !important; max-width: 300px !important; margin: 0 auto !important; box-sizing: border-box !important; border: none !important; outline: none !important; }';
echo '</style>';
}
// Modal container (only for non-AJAX requests)
if (!$is_modal_request) {
echo '<div id="story-modal" class="modal">';
echo '<div class="modal-content">';
echo '<span class="modal-close">×</span>';
echo '<div id="modal-body"></div>';
echo '</div>';
echo '</div>';
}
$stmt->close();
$conn->close();
?>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Synchronize with PHP DEBUG setting
const DEBUG = <?php echo DEBUG ? 'true' : 'false'; ?>;
// Debug log setup
let debugLog = null;
if (DEBUG) {
debugLog = document.createElement('div');
debugLog.id = 'debug-log';
debugLog.style.position = 'fixed';
debugLog.style.bottom = '10px';
debugLog.style.left = '10px';
debugLog.style.background = 'rgba(0, 0, 0, 0.8)';
debugLog.style.color = 'white';
debugLog.style.padding = '10px';
debugLog.style.zIndex = '1000';
debugLog.style.maxHeight = '200px';
debugLog.style.overflowY = 'auto';
document.body.appendChild(debugLog);
}
function logDebug(message, color = 'green') {
if (DEBUG && debugLog) {
debugLog.insertAdjacentHTML('beforeend', `<div style="color: ${color}; font-weight: bold;">Debug: ${message}</div>`);
debugLog.scrollTop = debugLog.scrollHeight;
}
if (DEBUG && console) console.log(`Debug: ${message}`, { color });
}
if (DEBUG) logDebug('Modal script loaded');
const modal = document.getElementById('story-modal');
const modalBody = document.getElementById('modal-body');
const closeBtn = document.querySelector('.modal-close');
const triggers = document.querySelectorAll('.modal-trigger');
if (DEBUG) logDebug('Found ' + triggers.length + ' modal triggers');
// Verify PayPal and modal functionality
triggers.forEach(trigger => {
trigger.addEventListener('click', function(e) {
if (DEBUG) logDebug(`Modal trigger clicked: ${this.getAttribute('data-modal-id') || this.getAttribute('data-modal-link')}`, 'green');
});
});
document.querySelectorAll('.paypal-embed').forEach(embed => {
if (DEBUG) logDebug(`PayPal embed found: ${embed.id}`, 'green');
});
// Function to render embed blocks with dynamic delay
function renderEmbed(item, index, total) {
const container = document.getElementById(`embed-${item.id}`);
if (!container) {
if (DEBUG) logDebug(`Container not found for embed ID ${item.id}`, 'red');
return;
}
const divMatch = item.code.match(/<div\s+[^>]*id="[^"]+"[^>]*>/i);
const buttonMatch = item.code.match(/<script>\s*paypal\.Buttons\([\s\S]*?\)\.render\(['"][^'"]+['"]\);\s*<\/script>/i);
if (DEBUG) {
logDebug(`Div match for ID ${item.id}: ${divMatch ? 'Success' : 'Failed'}`, divMatch ? 'green' : 'red');
logDebug(`Button match for ID ${item.id}: ${buttonMatch ? 'Success' : 'Failed'}`, buttonMatch ? 'green' : 'red');
if (buttonMatch) logDebug(`Button script content for ID ${item.id}: ${buttonMatch[0]}`, 'orange');
}
if (item.type === 'PayPal' && divMatch && buttonMatch) {
const uniqueId = `paypal-button-container-${item.id}`;
let divContent = divMatch[0].replace(/id="[^"]+"/, `id="${uniqueId}"`);
container.innerHTML = divContent;
container.querySelector(`#${uniqueId}`).style.cssText = 'width: 100% !important; min-width: 300px !important; max-width: 300px !important; margin: 0 auto !important;';
if (DEBUG) logDebug(`Inserted div for PayPal ID ${item.id}`, 'orange');
function waitForSDK(callback) {
if (typeof paypal !== 'undefined') {
if (DEBUG) logDebug(`PayPal SDK available for ID ${item.id}`, 'green');
callback();
} else {
if (DEBUG) logDebug(`Checking SDK for ID ${item.id}, status: ${typeof paypal}`, 'yellow');
setTimeout(() => waitForSDK(callback), 100);
}
}
waitForSDK(() => {
let scriptContent = buttonMatch[0].replace(/^<script>|<\/script>$/g, '').trim();
scriptContent = scriptContent.replace(/\.render\(['"][^'"]+['"]\)/, `.render('#${uniqueId}')`);
const uniqueScript = `(function() { var paypalInstance = paypal.Buttons; ${scriptContent} })();`;
const buttonScript = document.createElement('script');
buttonScript.textContent = uniqueScript;
document.body.appendChild(buttonScript);
if (DEBUG) logDebug(`Injected unique button script for ID ${item.id}`, 'orange');
const dynamicDelay = index * 1500 + (total * 500);
setTimeout(() => {
const paypalButtons = document.querySelectorAll(`#${uniqueId} .paypal-buttons`);
const paypalIframes = document.querySelectorAll(`#${uniqueId} iframe`);
if (DEBUG) logDebug(`Found ${paypalButtons.length} button(s) and ${paypalIframes.length} iframe(s) for ID ${item.id} after ${dynamicDelay}ms`, paypalButtons.length > 0 ? 'green' : 'red');
paypalButtons.forEach((button, btnIndex) => {
const iframe = paypalIframes[btnIndex];
if (button && iframe) {
button.style.cssText += 'width: 100% !important; min-width: 300px !important; max-width: 300px !important; margin: 0 auto !important; border: none !important; outline: none !important; display: block !important;';
iframe.style.cssText += 'width: 100% !important; min-width: 300px !important; max-width: 300px !important; margin: 0 auto !important; border: none !important; outline: none !important; display: block !important;';
if (DEBUG) {
const style = window.getComputedStyle(button);
logDebug(`Computed style for button ${uniqueId} (index ${btnIndex}): width=${style.width}, margin=${style.margin}, justify-content=${style.justifyContent}`, 'purple');
}
} else if (DEBUG) {
logDebug(`Button or iframe not found for ID ${item.id} at index ${btnIndex}`, 'red');
}
});
}, dynamicDelay);
});
} else if (item.type === 'YouTube') {
container.innerHTML = item.code;
container.style.display = 'block';
if (DEBUG) logDebug(`Rendered YouTube embed for ID ${item.id}`, 'orange');
} else {
container.innerHTML = `<div class="embed-fallback" id="fallback-${item.id}">${item.code}</div>`;
container.style.display = 'block';
if (DEBUG) logDebug(`Fallback rendered for ID ${item.id} (parsing failed, scripts not executed)`, 'red');
}
}
if (window.contentCode && Array.isArray(window.contentCode)) {
window.contentCode.forEach((item, index) => {
renderEmbed(item, index, window.contentCode.length);
});
} else if (DEBUG) {
logDebug('contentCode is not an array or unavailable', 'red');
}
function adjustDesktopLayout() {
if (window.innerWidth >= 1024) {
const embedContainers = document.querySelectorAll('.main__right .section-hero--full .content-embed-container');
embedContainers.forEach(container => {
container.style.margin = '0 auto !important';
if (DEBUG) logDebug(`Adjusted desktop container centering for ${container.querySelector('.paypal-embed')?.id}`, 'blue');
});
}
}
window.addEventListener('load', adjustDesktopLayout);
window.addEventListener('resize', adjustDesktopLayout);
function openModal(content) {
const tempDiv = document.createElement('div');
tempDiv.innerHTML = content;
const backgroundWrappers = tempDiv.querySelectorAll('.background-image-wrapper');
backgroundWrappers.forEach(wrapper => wrapper.remove());
const buttons = tempDiv.querySelectorAll('.content__buttons');
buttons.forEach(button => button.remove());
const debugMessages = tempDiv.querySelectorAll('div[style*="color: purple"], div[style*="color: blue"], div[style*="color: red"], div[style*="color: green"]');
debugMessages.forEach(msg => msg.remove());
let combinedContent = '';
const sections = tempDiv.querySelectorAll('.modal-story-content');
if (DEBUG) logDebug('Found ' + sections.length + ' modal-story-content sections');
if (sections.length > 0) {
sections.forEach((section, index) => {
combinedContent += section.outerHTML.trim();
if (index < sections.length - 1) {
combinedContent += '<div class="modal-section-separator"></div>';
}
});
} else {
const fallbackSections = tempDiv.querySelectorAll('.section-hero__content');
if (DEBUG) logDebug('Found ' + fallbackSections.length + ' section-hero__content sections');
if (fallbackSections.length > 0) {
fallbackSections.forEach((section, index) => {
const title = section.querySelector('h1');
const image = section.querySelector('.content-image');
const content = section.querySelector('.generic-content');
const newContent = document.createElement('div');
newContent.className = 'modal-story-content';
if (title) newContent.appendChild(title.cloneNode(true));
if (image) newContent.appendChild(image.cloneNode(true));
if (content) newContent.appendChild(content.cloneNode(true));
combinedContent += newContent.outerHTML.trim();
if (index < fallbackSections.length - 1) {
combinedContent += '<div class="modal-section-separator"></div>';
}
});
} else {
const genericContent = tempDiv.querySelector('.generic-content');
if (genericContent) {
if (DEBUG) logDebug('Falling back to .generic-content');
const newContent = document.createElement('div');
newContent.className = 'modal-story-content';
newContent.appendChild(genericContent.cloneNode(true));
combinedContent = newContent.outerHTML.trim();
} else {
if (DEBUG) logDebug('No content found in .modal-story-content, .section-hero__content, or .generic-content', 'red');
combinedContent = '<p>Content could not be parsed from the page.</p>';
}
}
}
modalBody.innerHTML = combinedContent;
modal.style.display = 'block';
modal.setAttribute('aria-hidden', 'false');
if (modalBody.children.length > 0 && closeBtn) {
closeBtn.focus();
}
if (DEBUG) logDebug('Modal opened');
}
function closeModal() {
modal.style.display = 'none';
modal.setAttribute('aria-hidden', 'true');
modalBody.innerHTML = '';
if (DEBUG && debugLog) {
debugLog.innerHTML = '';
}
if (DEBUG) logDebug('Modal closed');
}
if (modal && modalBody && closeBtn && triggers) {
triggers.forEach(trigger => {
trigger.addEventListener('click', function(e) {
e.preventDefault();
const modalId = this.getAttribute('data-modal-id');
if (modalId) {
const contentDiv = document.getElementById(modalId);
if (contentDiv) {
const content = contentDiv.innerHTML;
if (DEBUG) logDebug('Stories modal triggered, content from ID: ' + modalId);
if (DEBUG) logDebug('Modal content length: ' + content.length + ' characters', 'purple');
openModal(content);
} else {
openModal('<p>Content not found.</p>');
if (DEBUG) logDebug('Modal content not found for ID: ' + modalId, 'red');
}
return;
}
const link = this.getAttribute('data-modal-link');
if (DEBUG) logDebug('Trigger clicked, link: ' + link);
if (!link || link === '#' || link.includes('index.php')) {
openModal('<p>This link cannot be loaded in a modal to prevent recursive loading.</p>');
return;
}
let basePath = window.location.origin;
let absoluteLink;
try {
if (link.startsWith('http://') || link.startsWith('https://')) {
absoluteLink = link;
} else if (link.startsWith('/')) {
absoluteLink = new URL(link, window.location.origin).href;
} else {
absoluteLink = new URL(link, window.location.origin + '/').href;
}
absoluteLink += (absoluteLink.includes('?') ? '&' : '?') + 'modal=1';
if (DEBUG) logDebug('Fetching absolute link: ' + absoluteLink);
} catch (error) {
if (DEBUG) logDebug('URL construction error: ' + error.message, 'red');
openModal('<p>Invalid URL format.</p>');
return;
}
openModal('<p>Loading...</p>');
fetch(absoluteLink, {
headers: {
'X-Requested-With': 'XMLHttpRequest'
}
})
.then(response => {
if (DEBUG) logDebug('Fetch response status: ' + response.status + ' ' + response.statusText);
if (!response.ok) {
throw new Error('Network response was not ok: ' + response.statusText);
}
return response.text();
})
.then(data => {
if (DEBUG) logDebug('Fetched HTML length: ' + data.length);
const parser = new DOMParser();
const doc = parser.parseFromString(data, 'text/html');
let combinedContent = '';
const sections = doc.querySelectorAll('.modal-story-content');
if (DEBUG) logDebug('Found ' + sections.length + ' modal-story-content sections in fetched content');
if (sections.length > 0) {
sections.forEach((content, index) => {
combinedContent += content.outerHTML.trim();
if (index < sections.length - 1) {
combinedContent += '<div class="modal-section-separator"></div>';
}
});
} else {
const fallbackSections = doc.querySelectorAll('.section-hero__content');
if (DEBUG) logDebug('Found ' + fallbackSections.length + ' section-hero__content sections');
if (fallbackSections.length > 0) {
fallbackSections.forEach((section, index) => {
const title = section.querySelector('h1');
const image = section.querySelector('.content-image');
const content = section.querySelector('.generic-content');
const newContent = document.createElement('div');
newContent.className = 'modal-story-content';
if (title) newContent.appendChild(title.cloneNode(true));
if (image) newContent.appendChild(image.cloneNode(true));
if (content) newContent.appendChild(content.cloneNode(true));
combinedContent += newContent.outerHTML.trim();
if (index < fallbackSections.length - 1) {
combinedContent += '<div class="modal-section-separator"></div>';
}
});
} else {
const genericContent = doc.querySelector('.generic-content');
if (genericContent) {
if (DEBUG) logDebug('Falling back to .generic-content');
const newContent = document.createElement('div');
newContent.className = 'modal-story-content';
newContent.appendChild(genericContent.cloneNode(true));
combinedContent = newContent.outerHTML.trim();
} else {
if (DEBUG) logDebug('No content found in .modal-story-content, .section-hero__content, or .generic-content', 'red');
combinedContent = '<p>Content could not be parsed from the page.</p>';
}
}
}
if (combinedContent) {
openModal(combinedContent);
} else {
openModal('<p>No content found.</p>');
}
})
.catch(error => {
if (DEBUG) logDebug('Fetch error: ' + error.message, 'red');
openModal('<p>Sorry, the content could not be loaded: ' + error.message + '</p>');
});
});
});
closeBtn.addEventListener('click', closeModal);
window.addEventListener('click', function(event) {
if (event.target === modal) {
closeModal();
}
});
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape' && modal.style.display === 'block') {
closeModal();
}
});
} else {
if (DEBUG) logDebug('Modal elements missing (modal, modalBody, closeBtn, or triggers)', 'red');
}
});
</script>
This fix makes things more worse, like one of the fixes earlier. First of all, the site logo get moved behind the left frame. Secondly, the left frame is now shown only at the top of the desktop view but not running down the entire website. The right content margin is NOT removed at all but given an extra vertical scroll bar. All titles in dynamic section is shown as "在北大遇上了 -- W同事的故事" instead of the rendered layout (Including inside modal). The section background-image has been extended too much over the title. Attached is a screenshot showing the extra scrollbar (Oval), the tall space above title and the missing left frame. I think the fix on background image should not touch existing styles like that of the section titles.
I've inspected the layout using another browser. I found that changing margin-left (See top right circle of the attached) of the background image to "-20px" and the width of the image wrapper class to 130% (another circles) are already good enough to achieve my intended layout. I saw the "top: -20px" style can set a great looking margin (red rectangle) above the title, but I was unable to find the style to control the margin for the bottom (After the action button). Please fix the CSS with these findings!
This version of CSS is much closer to what I want. Attached are two screenshots of the inspect window on more issues and desired improvements. First screen:First, I want the section background image to extend further above the title. Let's try -30px, as circled. Also, on Edge browser, I find the left edge of the background image to appear on TOP of the left frame just by a few pixels. I wonder if changing Z-index to -2, as circled, will move the image back behind the left frame (The screen is taken on another browser with no overflowing issue). Please also pay attention to the hand drawn arrows showing section content is now left-aligned in desktop view.
Second screen: This screen shows the CSS class of the content (Left circle). To solve the content alignment issue, I suggest to set both left and right margin to the same value (I tried 45px) for both desktop and mobile views. Please check to make sure this changes won't affect existing functions or undo previous fixes on the background-image display.I also find the word "sandbox" is automatically added to the YouTube embed code, causing the video to fail to load. For example:
t's strange that this version of CSS has RE-introduced the LR margin on the section background image that we have removed in the previous version. Can you inspect why?Before V4.20, I said://I've inspected the layout using another browser. I found that changing margin-left (See top right circle of the attached) of the background image to "-20px" and the width of the image wrapper class to 130% (another circles) are already good enough to achieve my intended layout. I saw the "top: -20px" style can set a great looking margin (red rectangle) above the title, //What I want for V4.21 is to keep the above (margin-left to -20px and image width to 130%) with:Have section background image to extend further above the title with a -30px value for "background-image-wrapper: top", and set z-index to -2 To insert an equal 45px of margin-left and margin-right to section-hero section-hero--full etc.
Can you check and implement again?
I think per our previous protocol of work you should not remove ANY styles from the CSS unless they're redundant or in conflict. Since the website is in production use this will cause great headache for the users. Please check if ALL styles of V4.20/21 are included in V4.22, with just changes in the background display and content centering related styles. Once confirmed I will do the testing again.
This version still fails to center the YouTube player and the content properly. Background image in also fails to show in full width of the right frame. Let's try another method. In the first image, you can see I've removed the entry-width property and ALL things except for the YouTube player are immediately centered (But I need to confirm on mobile view later). With centering in place, I can use the negative margin and width properties, as shown in the second image, to fix the background image properly (Not yet tested in Edge). I've also managed to make the background image a bit more transparent. Can you try this approach with V4.23?However, I still can't figure out how to center the video player inside "content-embed" or "content-embed-container". In very early version of the system we used to have no such issue. I wonder would anything "distant" could be upsetting the alignment.
With this version, I find the background image is still not showing properly. Can you check whether its left margin has been set to "-65px" and width to "120%"? For the centering, I can still see "--entry-width: 62ch" in the inspect window marked as "inherited from HTML". YouTube player looks less to the right but is still quite obvious, as shown in the attached image (Red arrow).
Before testing, there are a few notes to makeBackground Image: Once the "62ch" styles was disabled manually, "margin-left: -65px !important and width: 120% !important" has worked very well in the inspect window.PayPal Border: But why it's been okay until V4.23.1 without needing new button style?It seems that in intermediate widths (Not full width desktop view, not mobile view), things could get weird. Is this normal? I just expect the layout rendering will be either look A and look B depending on the media width. That's interesting to see look C sometimes.
Since this version still failed to disable entry-width the centering and background image display are still not right. The YouTube player returned to right aligned. I played with "content-embed" in and inspect window but failed move the player with any margin setting. Since you've moved it to the left (Just too much) before I wonder which style is controlling the positioning of the video iframe from YouTube? Since the standard YT embed code defines the video size in pixels I wonder how can it adapt to responsive layout.
--entry-width issue, the background image display, the YouTube player’s right alignment, and the responsive layout challenge with YouTube’s pixel-based embed code. Let’s dive into the problems and refine the solution for V4.25, using the current date and time (05:11 PM HKT, Sep 23, 2025) as a reference.--entry-width Persistence:
--entry-width (still 62ch) indicates the theme’s :root variable (--entry-width: 62ch) is overriding our unset !important and max-width: none !important. This is likely because .main__right > div (a parent of .content__entry) applies the variable, and our selector specificity isn’t high enough. We need to target the exact hierarchy or use inline-style-level specificity.Background Image Display:
--entry-width active, the margin-left: -65px and width: 120% on .background-image-wrapper are likely constrained by the 62ch width, preventing proper extension. Disabling --entry-width manually worked, so the fix hinges on overriding it effectively.YouTube Player Right Alignment:
.content-embed .video-embed rules and the theme’s .post__iframe or .video-embed styles. Your inability to move it with margins in the inspector points to a position or parent container issue. The previous left shift was due to left: 50% and transform: translateX(-50%) being too aggressive without proper container constraints..video-embed uses position: relative and width: 100%, while YouTube’s embed code (e.g., <iframe width="560" height="315" ...>) sets fixed pixels, which resists responsive scaling unless overridden.Responsive Layout with YouTube Embed:
padding-bottom: 56.25% (16:9 aspect ratio) and width: 100% to make it fluid, but the iframe’s inline width and height attributes can override this unless stripped or controlled via CSS..main__right .content__entry and add a direct style override on .section-hero__content to ensure --entry-width is neutralized.margin-left: -65px and width: 120% with a higher-specificity rule, tied to the corrected width.text-align: center and margin: 0 auto, while ensuring the iframe’s pixel attributes are overridden. We’ll also check the theme’s .content-embed interference.vw-based max-widths and enforce aspect ratio scaling to make YouTube responsive, overriding inline attributes./* Custom CSS for Lifenavi (navi.claudioflute.live) and Chaplaincy Admin (admin.nlt-chaplaincy.org) - Version 4.25 */
/* V4.25: Fix --entry-width override, adjust background image, center YouTube player with responsive scaling (05:20 PM HKT, Sep 23, 2025) */
/* Debug: If you see this comment in browser inspector, custom.css is loaded correctly */
body {
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.font-test {
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 24px;
color: red;
}
.main__right .content__entry {
position: relative;
padding: 20px;
min-height: 200px;
margin: 0 auto;
max-width: none !important; /* V4.25: Stronger override for --entry-width */
--entry-width: unset !important; /* V4.25: Ensure theme variable is unset */
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-color: #fff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
box-sizing: border-box;
}
div.content__entry:empty {
display: none;
}
html, body {
overflow-x: hidden;
width: 100%;
margin: 0;
padding: 0;
}
.main.page, .container, .post__entry {
width: 100%;
max-width: 100%;
margin: 0;
padding: 0;
box-sizing: border-box;
overflow-x: hidden;
}
@media (min-width: 1024px) {
.main.page .main__right {
max-width: 64rem;
margin: 0 auto;
padding: 0 20px;
box-sizing: border-box;
}
}
@media (max-width: 1023px) {
.main.page .main__right {
width: 100%;
max-width: 100%;
margin: 0;
padding: 0 10px;
}
}
@media (min-width: 768px) and (max-width: 1023px) {
.main.page .main__right {
max-width: 64rem !important; /* V4.25: Enforce desktop-like width */
margin: 0 auto !important;
padding: 0 20px !important;
}
.section-hero--full .background-image-wrapper {
margin-left: -65px !important; /* V4.25: Ensure consistency */
width: 120% !important;
}
.content-embed .video-embed,
.content-embed-container .video-embed {
max-width: 800px !important; /* V4.25: Match desktop */
}
}
.section-hero--full {
width: 100%;
margin: 0 auto;
padding: 20px 0;
position: relative;
min-height: 200px;
background-color: #fff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
overflow: visible;
}
.section-hero--full .section-hero__content {
margin: 0 45px !important;
padding: 0;
box-sizing: border-box;
max-width: none !important; /* V4.25: Override theme constraint */
--entry-width: unset !important; /* V4.25: Unset theme variable */
width: 100% !important; /* V4.25: Ensure full width */
}
.section-hero--full .column {
position: relative !important;
min-height: 200px;
overflow: visible !important;
z-index: 0;
}
.section-hero--full .section-hero__content,
.section-hero--full .column {
position: relative;
min-height: 200px;
overflow: visible;
}
/* V4.25: Background image with -65px margin, 120% width, tied to parent width */
.section-hero--full .background-image-wrapper {
position: absolute !important;
top: -30px !important;
left: 0 !important;
margin-left: -65px !important; /* V4.25: Fixed margin */
width: 120% !important; /* V4.25: Fixed width relative to parent */
height: calc(100% + 40px) !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
z-index: -2 !important;
opacity: 0.8 !important;
visibility: visible !important;
display: block !important;
box-sizing: border-box !important;
}
.section-hero--full .column .background-image-wrapper {
position: absolute !important;
top: -30px !important;
left: 0 !important;
margin-left: -65px !important; /* V4.25: Consistent margin */
width: 120% !important; /* V4.25: Consistent width */
height: calc(100% + 40px) !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
z-index: -2 !important;
opacity: 0.8 !important;
visibility: visible !important;
display: block !important;
box-sizing: border-box !important;
}
@media (min-width: 768px) {
.section-hero--full .column .background-image-wrapper {
position: absolute !important;
top: -30px !important;
left: 0 !important;
margin-left: -65px !important; /* V4.25: Desktop fix */
width: 120% !important; /* V4.25: Desktop fix */
height: calc(100% + 40px) !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
z-index: -2 !important;
opacity: 0.8 !important;
visibility: visible !important;
display: block !important;
box-sizing: border-box !important;
}
}
@media (max-width: 767px) {
.section-hero--full .column .background-image-wrapper {
position: absolute !important;
top: -15px !important;
left: 0 !important;
margin-left: -65px !important; /* V4.25: Mobile fix */
width: 120% !important; /* V4.25: Mobile fix */
height: calc(100% + 30px) !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
z-index: -2 !important;
opacity: 0.8 !important;
visibility: visible !important;
display: block !important;
box-sizing: border-box !important;
}
.section-hero--full .content__buttons::after {
height: 15px;
}
.section-hero--full .section-hero__content {
margin: 0 45px !important;
}
}
.section-hero--full .background-image-wrapper,
.section-hero--full .column .background-image-wrapper {
position: absolute !important;
top: -30px !important;
left: 0 !important;
margin-left: -65px !important; /* V4.25: Unified fix */
width: 120% !important; /* V4.25: Unified fix */
height: calc(100% + 40px) !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
z-index: -2 !important;
opacity: 0.8 !important;
visibility: visible !important;
display: block !important;
box-sizing: border-box !important;
}
.section-hero--full:has(.background-image-wrapper) h1,
.section-hero--full:has(.background-image-wrapper) .generic-content {
color: #fff !important;
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}
/* V4.25: YouTube centering with responsive override */
.content-embed,
.content-embed-container {
text-align: center !important;
margin: 0 auto !important;
max-width: 100% !important;
width: 100% !important;
box-sizing: border-box !important;
}
.content-embed .video-embed,
.content-embed-container .video-embed {
position: relative !important;
display: inline-block !important;
width: 100% !important;
max-width: 100vw !important; /* V4.25: Responsive cap */
padding-bottom: 56.25% !important; /* 16:9 aspect ratio */
margin: 0 auto !important;
overflow: hidden !important;
}
.content-embed .video-embed iframe,
.content-embed-container .video-embed iframe {
position: absolute !important;
top: 0 !important;
left: 50% !important;
transform: translateX(-50%) !important;
width: 100% !important; /* V4.25: Override YouTube pixel width */
height: 100% !important; /* V4.25: Override YouTube pixel height */
max-width: 100% !important;
border: 0 !important;
display: block !important;
box-sizing: border-box !important;
}
@media (max-width: 767px) {
.content-embed .video-embed,
.content-embed-container .video-embed {
max-width: 100% !important; /* V4.25: Mobile adjustment */
padding-bottom: 56.25% !important;
}
.content-embed .video-embed iframe,
.content-embed-container .video-embed iframe {
max-width: 100vw !important;
}
}
/* V4.25: Remove unexpected PayPal border */
.paypal-button {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
/* Preserve existing layout and other styles */
.section-hero--column {
flex: 1;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
padding: 10px;
}
.section-group {
display: flex;
flex-wrap: nowrap;
gap: 20px;
max-width: 1200px;
margin: 0 auto;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.layout-2-column {
display: flex;
justify-content: space-between;
}
.layout-2-column .section-hero--column {
flex: 1 0 49%;
max-width: 49%;
}
.layout-3-column {
display: flex;
justify-content: space-between;
}
.layout-3-column .section-hero--column {
flex: 1 0 32%;
max-width: 32%;
}
@media (min-width: 768px) {
.section-hero--full.layout-2-column .section-hero__content {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
}
.section-hero--full.layout-3-column .section-hero__content {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 20px;
}
.column {
width: 100%;
position: relative;
min-height: 0;
}
.content-embed {
width: 300px;
margin: 0 auto !important;
}
.paypal-button {
width: 300px !important;
max-width: 300px !important;
box-sizing: border-box;
margin: 0 auto;
}
}
@media (max-width: 767px) {
.section-hero--full .section-hero__content {
display: block;
}
.column {
margin-bottom: 20px;
width: 100%;
position: relative;
min-height: 0;
}
.content-embed {
width: 100% !important;
margin: 0 auto !important;
}
.paypal-button {
width: 100% !important;
max-width: none !important;
}
.content__buttons {
text-align: center !important;
}
}
.align-left {
text-align: left;
}
.content-image.align-left, .video-embed.align-left {
margin: 1em 0;
}
.align-center {
text-align: center;
}
h1, h2, h3, h4, h5, h6 {
font-family: "LXGW WenKai TC", "Times New Roman", serif !important;
margin-bottom: 1.5em !important;
}
.content__entry h1 {
font-size: 2em;
font-weight: 700;
line-height: 1.2;
color: #333;
margin-bottom: 1.5em !important;
padding-top: 1em;
text-align: center;
text-shadow: none;
font-family: "LXGW WenKai TC", "Times New Roman", serif !important;
}
.generic-content {
margin: 0 auto;
max-width: 800px;
font-size: 1em;
line-height: 1.6;
color: #333;
margin-bottom: 1em;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.generic-content p {
margin: 0 0 1em 0;
}
.generic-content ul,
.generic-content ol {
margin: 0 0 1em 0;
padding: 0 !important;
list-style: none !important;
}
.generic-content li {
margin-bottom: 0.5em;
text-align: inherit;
list-style: none !important;
}
.generic-content ul[style*="list-style"],
.generic-content ol[style*="list-style"],
.generic-content li[style*="list-style"] {
list-style: none !important;
}
.content__buttons {
text-align: center !important;
margin: 2em 0 1em 0;
}
.content__buttons a.myButton {
display: inline-block;
margin: 0 auto;
}
.content__entry .content__buttons {
text-align: center !important;
}
/* Button Styles */
.content__buttons a.myButton {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
a.myButtonBig {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.myButtonBig {
background: linear-gradient(to bottom, #44c767 5%, #5cbf2a 100%);
background-color: #44c767;
border-radius: 28px;
border: 1px solid #18ab29;
display: inline-block;
cursor: pointer;
color: #ffffff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 21px;
font-weight: bold;
padding: 24px 42px;
text-decoration: none;
text-shadow: 0px 1px 0px #2f6627;
transition: all 0.3s ease;
}
.myButtonBig:hover {
background: linear-gradient(to bottom, #5cbf2a 5%, #44c767 100%);
background-color: #5cbf2a;
border-color: #137c21;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.myButtonBig:active {
position: relative;
top: 1px;
background: linear-gradient(to bottom, #3ba052 5%, #4aa62b 100%);
background-color: #3ba052;
border-color: #0f5c18;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
.myButton {
background: linear-gradient(to bottom, #44c767 5%, #5cbf2a 100%);
background-color: #44c767;
border-radius: 28px;
border: 1px solid #18ab29;
display: inline-block;
cursor: pointer;
color: #ffffff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 17px;
font-weight: bold;
padding: 16px 31px;
text-decoration: none;
text-shadow: 0px 1px 0px #2f6627;
transition: all 0.3s ease;
}
.myButton:hover {
background: linear-gradient(to bottom, #5cbf2a 5%, #44c767 100%);
background-color: #5cbf2a;
border-color: #137c21;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.myButton:active {
position: relative;
top: 1px;
background: linear-gradient(to bottom, #3ba052 5%, #4aa62b 100%);
background-color: #3ba052;
border-color: #0f5c18;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
/* Remove white space for title-text model when no image */
.column[data-model="title-text"]:not(:has(.content-image)) {
min-height: 0 !important;
padding-bottom: 0 !important;
}
/* Adjust for title-text model without image */
.column[data-model="title-text"]:not(:has(.content-image)) .generic-content {
margin-bottom: 0 !important;
}
.welcome-image {
max-width: 100%;
height: auto;
margin: 1em auto;
display: block;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.video-embed {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
margin: 0 auto !important;
max-width: 800px;
background: none;
text-align: center !important;
}
.video-embed iframe {
position: absolute;
top: 0;
left: 50% !important;
transform: translateX(-50%) !important;
width: 100% !important;
height: 100%;
max-width: 100% !important;
border: 0;
display: block !important;
}
.separator {
text-align: center;
margin: 40px 0 20px 0;
}
.separator-image {
max-width: 100%;
height: auto;
display: block;
margin: 0 auto;
z-index: 1;
}
.separator img[src$="down_arrow.png"] {
max-width: 256px;
}
.content__entry.content__entry--full:first-child {
min-height: 0 !important;
padding-top: 0 !important;
margin-top: 0 !important;
}
.main.page .main__right:first-child {
margin-top: -3.8rem !important;
}
.banner--after-content {
margin: 0 !important;
padding: 0 !important;
border: none !important;
outline: none !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
@media (max-width: 768px) {
.main.page .main__right:first-child {
margin-top: 0 !important;
margin-bottom: 0 !important;
}
.main.page .container:first-child,
.main.page .post__entry:first-child {
margin: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.main.page .main__right .main__right--bottom:first-child {
margin-top: -3.8rem !important;
margin-bottom: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.main.page .container > .main__right > .main__right--bottom:first-child,
.main.page .post__entry > .main__right > .main__right--bottom:first-child {
margin: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.banner--after-content {
margin: 0 !important;
padding: 0 !important;
border: none !important;
outline: none !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
}
@media (min-width: 769px) and (max-width: 1023px) {
.main.page .main__right {
margin: 0 auto !important;
max-width: 90% !important;
width: auto !important;
}
.main.page .main__right .content__entry--full {
margin: 0 auto !important;
max-width: 100% !important;
}
.main.page .main__right .main__right--bottom {
margin: 0 auto !important;
max-width: 100% !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
}
.main.page .main__right .main__right--bottom .section-hero--full:first-child {
margin-top: 0 !important;
padding-top: 0 !important;
}
.content__entry.content__entry--full .separator:first-child {
margin-top: 0;
}
.section-hero--full:not([style*="background-image"]) + .separator {
margin-top: 40px;
}
hr {
display: none !important;
visibility: hidden !important;
}
.post__content hr,
.container hr,
.post__content hr[style],
.container hr[style] {
display: none !important;
visibility: hidden !important;
}
.post__content::before,
.post__content::after,
.container::before,
.container::after,
.post__entry::before,
.post__entry::after,
.content__entry::before,
.content__entry::after,
.generic-content::before,
.generic-content::after {
display: none !important;
border: none !important;
content: none !important;
}
.separator::before,
.separator::after {
display: none !important;
border: none !important;
content: none !important;
}
body,
body p,
body h2,
body h3,
body h4,
body h5,
body h6,
.post__content,
.post__content p,
.post__content h2,
.post__content h3,
.post__content h4,
.post__content h5,
.post__content h6,
.container,
.container p,
.container h2,
.container h3,
.container h4,
.container h5,
.container h6 {
color: #333 !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
h1.post__title,
h1.hero__title,
h1.site__title {
color: #fff !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
a.button,
a.btn,
a.post__button,
.post__content a.button,
.post__content a.btn,
.post__content a.post__button,
.container a.button,
.container a.btn,
.container a.post__button {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Custom Modal Styles */
.modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.5);
}
.modal-content {
background-color: #fff;
margin: 5% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 800px;
min-height: 200px;
position: relative;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
box-sizing: border-box;
}
.modal-close {
color: #aaa;
position: absolute;
top: 10px;
right: 20px;
font-size: 28px;
font-weight: bold;
cursor: pointer;
transition: color 0.3s ease;
z-index: 1001;
}
.modal-close:hover,
.modal-close:focus {
color: #000;
text-decoration: none;
}
#modal-body {
font-size: 1em;
line-height: 1.6;
color: #333;
max-width: 100%;
box-sizing: border-box;
padding-top: 40px;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
overflow-x: hidden;
}
#modal-body h1 {
font-size: 1.5em;
margin-bottom: 0.5em;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
#modal-body p {
margin-bottom: 1em;
}
#modal-body * {
max-width: 100%;
height: auto;
box-sizing: border-box;
}
#modal-body img,
#modal-body div,
#modal-body table {
max-width: 100%;
height: auto;
}
#modal-body .welcome-image {
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.modal[aria-hidden="false"] {
display: block;
}
.modal-close:focus {
outline: 2px solid #44c767;
outline-offset: 2px;
}
/* Custom separator for modal sections */
.modal-section-separator {
text-align: center;
margin: 20px 0;
font-size: 24px;
line-height: 1;
color: #666;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.modal-section-separator::before {
content: "···";
}
/* Modal-specific content container */
.modal-story-content {
max-width: 100%;
margin: 0 auto;
padding: 20px;
box-sizing: border-box;
overflow-x: hidden;
}
.modal-story-content h1 {
font-size: 2rem;
margin-bottom: 1rem;
text-align: center;
}
.modal-story-content .content-image {
max-width: 100%;
margin: 1rem 0;
}
.modal-story-content .generic-content {
font-size: 1rem;
line-height: 1.6;
}
/* Hide background image in modal */
.modal .background-image-wrapper {
display: none !important;
}
/* Chaplaincy Admin specific overrides */
.report-container {
max-width: 100% !important;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.content__entry {
max-width: 100% !important;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
box-sizing: border-box !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.content__entry table.report-table {
width: 100% !important;
margin: 0 !important;
padding: 0 !important;
border-collapse: collapse !important;
box-sizing: border-box !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* PP Button Layout Adjustments */
@media (min-width: 769px) {
.layout-3-column.position-100 .section-hero--column {
flex: 1 0 32%;
max-width: 32%;
}
}
@media (max-width: 768px) {
.layout-3-column.position-100 .section-hero--column {
flex: 1 0 100%;
max-width: 100%;
}
}
.section-group.position-100,
.section-hero--full {
margin-top: 2em;
}
/* Remove shadow from section images */
.content-image img,
.welcome-image {
box-shadow: none !important;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
}
/* Ensure no border or other effects interfere */
.content-image,
.modal-image {
box-shadow: none !important;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
}
/* V4.21: Debug cleanup - hide debug messages */
div[style*="color: orange"],
div[style*="color: purple"],
div[style*="color: blue"],
div[style*="color: green"],
div[style*="color: red"],
div[style*="Debug"] {
display: none !important;
visibility: hidden !important;
}
--entry-width Override:
.main__right .content__entry and .section-hero--full .section-hero__content with max-width: none !important and width: 100% !important to force full width, bypassing the theme’s 62ch constraint. The --entry-width: unset !important is retained for variable-level control.Background Image:
margin-left: -65px !important and width: 120% !important with consistent application across all .background-image-wrapper rules, relying on the width fix to ensure proper display.YouTube Centering:
.content-embed and .content-embed-container to use text-align: center !important and margin: 0 auto !important, with .video-embed as inline-block to center naturally. Overrode YouTube’s pixel dimensions with width: 100% !important and height: 100% !important, using max-width: 100vw to cap responsiveness..video-embed (positioned by .post__iframe) is countered with higher specificity and inline overrides.Responsive Adaptation:
padding-bottom: 56.25% !important and max-width: 100vw !important to ensure the 16:9 aspect ratio scales with the viewport, overriding YouTube’s fixed 560x315 pixels.custom.css with the above V4.25 code.--entry-width is unset in the inspector for .content__entry and .section-hero__content..background-image-wrapper for -65px margin and 120% width at 1920x1280 and resized views..content-embed .video-embed iframe with left: 50% !important and transform: translateX(-50%) !important, nested within .video-embed’s position: relative. The theme’s .video-embed and .post__iframe may still apply position: relative and width: 100%, but our !important rules should dominate. If it fails, the iframe’s inline style attribute (from YouTube) might need a PHP filter to remove width and height.width: 100% !important and height: 100% !important within a container that uses padding-bottom: 56.25% for aspect ratio. This ensures scalability, but if the iframe retains inline styles, we may need to adjust the embed code via Publii’s settings..content__entry and .section-hero__content to confirm --entry-width is unset..background-image-wrapper and its parent at 1920x1280 and a resized view.DEBUG = true) and share the logged embed code to identify inline style conflicts.Let’s get this sorted with V4.25—looking forward to your feedback!
Yes, your recall is right! Let's continue to work on the fix.V4.25 shows improvement finally, with the background image taking full width in Zen Browser desktop view. White right margin is still visible with a small overflow onto the the left frame on Edge desktop view (Image 1). YouTube player looks centered on desktop view of both browsers. Regardless of browsers, the mobile view shows the entire main_right frame moved right with contents cut-off by the browser window at the right. This looks like if the content frame is wider than the browser window such that the right part becomes hidden (Image 2).The last issue is the default divider image (enabled in web_content with the "chk_divider" field) seems to have its own alignment independent from all other elements in the main_right frame (Image 1, red line).
This has been too aggressive and section images are now floating onto the left frame. Section text and main image are jamming together. And default separator image is now at the same height of the section title. Please re-evaluate your fix. For example, in my previous testing in inspect window, "margin-left to -70px and width to 125%" for the "background-image-wrapper" are enough for fixing the background image. I'm not sure how to handle the slight overflow on edge (By reducing margin-left to a smaller value?) But margin-left: -62.5% should not be needed for our main goal is the fix a very small overflow in Edge (But not existing in Zen browser) only. Please review our chat "AppGini Low-code Web System Development 18" and "AppGini Low-code Web System Development 17" for additional context.
For the background-image-wrapper, I’ll revert to margin-left: -70px and width: 125% as you found effective, removing the -62.5% adjustment since it’s not needed for the Edge overflow fix. To handle the slight overflow on Edge, we can fine-tune margin-left—let’s try -60px to reduce it without overcompensating. This should align with your testing and avoid affecting other browsers.
The floating section images and text jamming suggest a layout shift. I’ll ensure the .main__right .content__entry and .section-hero--full rules maintain proper spacing by reinforcing position: relative and adding clear: both where needed to prevent overlap with the left frame. For the separator image aligning with the section title, I’ll adjust its positioning to shift it downward—adding a top offset (e.g., top: 20px) to the .main__right .separator-image rule should help.
Here’s the updated V4.27:
/* Custom CSS for Lifenavi (navi.claudioflute.live) and Chaplaincy Admin (admin.nlt-chaplaincy.org) - Version 4.27 */
/* V4.27: Refine background image for Edge, fix layout overlap, adjust separator position (06:20 PM HKT, Sep 23, 2025) */
/* Debug: If you see this comment in browser inspector, custom.css is loaded correctly */
body {
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.font-test {
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 24px;
color: red;
}
.main__right .content__entry {
position: relative;
padding: 20px;
min-height: 200px;
margin: 0 auto;
max-width: none !important; /* V4.25: Stronger override for --entry-width */
--entry-width: unset !important; /* V4.25: Ensure theme variable is unset */
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-color: #fff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
box-sizing: border-box;
clear: both; /* V4.27: Prevent overlap with left frame */
}
div.content__entry:empty {
display: none;
}
html, body {
overflow-x: hidden;
width: 100%;
margin: 0;
padding: 0;
}
.main.page, .container, .post__entry {
width: 100%;
max-width: 100%;
margin: 0;
padding: 0;
box-sizing: border-box;
overflow-x: hidden;
}
@media (min-width: 1024px) {
.main.page .main__right {
max-width: 64rem;
margin: 0 auto;
padding: 0 20px;
box-sizing: border-box;
}
}
@media (max-width: 1023px) {
.main.page .main__right {
width: 100%;
max-width: 100%;
margin: 0;
padding: 0 10px;
}
}
@media (min-width: 768px) and (max-width: 1023px) {
.main.page .main__right {
max-width: 64rem !important; /* V4.25: Enforce desktop-like width */
margin: 0 auto !important;
padding: 0 20px !important;
}
.section-hero--full .background-image-wrapper {
margin-left: -60px !important; /* V4.27: Fine-tuned for Edge overflow */
width: 125% !important; /* V4.27: Effective width per testing */
}
.content-embed .video-embed,
.content-embed-container .video-embed {
max-width: 800px !important; /* V4.25: Match desktop */
}
}
.section-hero--full {
width: 100%;
margin: 0 auto;
padding: 20px 0;
position: relative;
min-height: 200px;
background-color: #fff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
overflow: visible;
}
.section-hero--full .section-hero__content {
margin: 0 45px !important;
padding: 0;
box-sizing: border-box;
max-width: none !important; /* V4.25: Override theme constraint */
--entry-width: unset !important; /* V4.25: Unset theme variable */
width: 100% !important; /* V4.25: Ensure full width */
}
.section-hero--full .column {
position: relative !important;
min-height: 200px;
overflow: visible !important;
z-index: 0;
}
.section-hero--full .section-hero__content,
.section-hero--full .column {
position: relative;
min-height: 200px;
overflow: visible;
}
/* V4.27: Adjusted background image for Edge overflow */
.section-hero--full .background-image-wrapper {
position: absolute !important;
top: -30px !important;
left: 0 !important;
margin-left: -60px !important; /* V4.27: Reduced margin for Edge */
width: 125% !important; /* V4.27: Per testing */
height: calc(100% + 40px) !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
z-index: -2 !important;
opacity: 0.8 !important;
visibility: visible !important;
display: block !important;
box-sizing: border-box !important;
}
.section-hero--full .column .background-image-wrapper {
position: absolute !important;
top: -30px !important;
left: 0 !important;
margin-left: -60px !important; /* V4.27: Consistent margin */
width: 125% !important; /* V4.27: Consistent width */
height: calc(100% + 40px) !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
z-index: -2 !important;
opacity: 0.8 !important;
visibility: visible !important;
display: block !important;
box-sizing: border-box !important;
}
@media (min-width: 768px) {
.section-hero--full .column .background-image-wrapper {
position: absolute !important;
top: -30px !important;
left: 0 !important;
margin-left: -60px !important; /* V4.27: Desktop fix */
width: 125% !important; /* V4.27: Desktop fix */
height: calc(100% + 40px) !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
z-index: -2 !important;
opacity: 0.8 !important;
visibility: visible !important;
display: block !important;
box-sizing: border-box !important;
}
}
@media (max-width: 767px) {
.section-hero--full .column .background-image-wrapper {
position: absolute !important;
top: -15px !important;
left: 0 !important;
margin-left: -60px !important; /* V4.27: Mobile fix */
width: 125% !important; /* V4.27: Mobile fix */
height: calc(100% + 30px) !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
z-index: -2 !important;
opacity: 0.8 !important;
visibility: visible !important;
display: block !important;
box-sizing: border-box !important;
}
.section-hero--full .content__buttons::after {
height: 15px;
}
.section-hero--full .section-hero__content {
margin: 0 45px !important;
}
/* V4.26: Fix mobile frame shift */
.main.page .main__right {
width: 100% !important;
max-width: 100% !important;
margin-right: 0 !important;
overflow-x: hidden !important;
}
}
.section-hero--full .background-image-wrapper,
.section-hero--full .column .background-image-wrapper {
position: absolute !important;
top: -30px !important;
left: 0 !important;
margin-left: -60px !important; /* V4.27: Unified fix */
width: 125% !important; /* V4.27: Unified fix */
height: calc(100% + 40px) !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
z-index: -2 !important;
opacity: 0.8 !important;
visibility: visible !important;
display: block !important;
box-sizing: border-box !important;
}
.section-hero--full:has(.background-image-wrapper) h1,
.section-hero--full:has(.background-image-wrapper) .generic-content {
color: #fff !important;
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}
/* V4.25: YouTube centering with responsive override */
.content-embed,
.content-embed-container {
text-align: center !important;
margin: 0 auto !important;
max-width: 100% !important;
width: 100% !important;
box-sizing: border-box !important;
}
.content-embed .video-embed,
.content-embed-container .video-embed {
position: relative !important;
display: inline-block !important;
width: 100% !important;
max-width: 100vw !important; /* V4.25: Responsive cap */
padding-bottom: 56.25% !important; /* 16:9 aspect ratio */
margin: 0 auto !important;
overflow: hidden !important;
}
.content-embed .video-embed iframe,
.content-embed-container .video-embed iframe {
position: absolute !important;
top: 0 !important;
left: 50% !important;
transform: translateX(-50%) !important;
width: 100% !important; /* V4.25: Override YouTube pixel width */
height: 100% !important; /* V4.25: Override YouTube pixel height */
max-width: 100% !important;
border: 0 !important;
display: block !important;
box-sizing: border-box !important;
}
@media (max-width: 767px) {
.content-embed .video-embed,
.content-embed-container .video-embed {
max-width: 100% !important; /* V4.25: Mobile adjustment */
padding-bottom: 56.25% !important;
}
.content-embed .video-embed iframe,
.content-embed-container .video-embed iframe {
max-width: 100vw !important;
}
}
/* V4.25: Remove unexpected PayPal border */
.paypal-button {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
/* Preserve existing layout and other styles */
.section-hero--column {
flex: 1;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
padding: 10px;
}
.section-group {
display: flex;
flex-wrap: nowrap;
gap: 20px;
max-width: 1200px;
margin: 0 auto;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.layout-2-column {
display: flex;
justify-content: space-between;
}
.layout-2-column .section-hero--column {
flex: 1 0 49%;
max-width: 49%;
}
.layout-3-column {
display: flex;
justify-content: space-between;
}
.layout-3-column .section-hero--column {
flex: 1 0 32%;
max-width: 32%;
}
@media (min-width: 768px) {
.section-hero--full.layout-2-column .section-hero__content {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
}
.section-hero--full.layout-3-column .section-hero__content {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 20px;
}
.column {
width: 100%;
position: relative;
min-height: 0;
}
.content-embed {
width: 300px;
margin: 0 auto !important;
}
.paypal-button {
width: 300px !important;
max-width: 300px !important;
box-sizing: border-box;
margin: 0 auto;
}
}
@media (max-width: 767px) {
.section-hero--full .section-hero__content {
display: block;
}
.column {
margin-bottom: 20px;
width: 100%;
position: relative;
min-height: 0;
}
.content-embed {
width: 100% !important;
margin: 0 auto !important;
}
.paypal-button {
width: 100% !important;
max-width: none !important;
}
.content__buttons {
text-align: center !important;
}
}
.align-left {
text-align: left;
}
.content-image.align-left, .video-embed.align-left {
margin: 1em 0;
}
.align-center {
text-align: center;
}
h1, h2, h3, h4, h5, h6 {
font-family: "LXGW WenKai TC", "Times New Roman", serif !important;
margin-bottom: 1.5em !important;
}
.content__entry h1 {
font-size: 2em;
font-weight: 700;
line-height: 1.2;
color: #333;
margin-bottom: 1.5em !important;
padding-top: 1em;
text-align: center;
text-shadow: none;
font-family: "LXGW WenKai TC", "Times New Roman", serif !important;
}
.generic-content {
margin: 0 auto;
max-width: 800px;
font-size: 1em;
line-height: 1.6;
color: #333;
margin-bottom: 1em;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.generic-content p {
margin: 0 0 1em 0;
}
.generic-content ul,
.generic-content ol {
margin: 0 0 1em 0;
padding: 0 !important;
list-style: none !important;
}
.generic-content li {
margin-bottom: 0.5em;
text-align: inherit;
list-style: none !important;
}
.generic-content ul[style*="list-style"],
.generic-content ol[style*="list-style"],
.generic-content li[style*="list-style"] {
list-style: none !important;
}
.content__buttons {
text-align: center !important;
margin: 2em 0 1em 0;
}
.content__buttons a.myButton {
display: inline-block;
margin: 0 auto;
}
.content__entry .content__buttons {
text-align: center !important;
}
/* Button Styles */
.content__buttons a.myButton {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
a.myButtonBig {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.myButtonBig {
background: linear-gradient(to bottom, #44c767 5%, #5cbf2a 100%);
background-color: #44c767;
border-radius: 28px;
border: 1px solid #18ab29;
display: inline-block;
cursor: pointer;
color: #ffffff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 21px;
font-weight: bold;
padding: 24px 42px;
text-decoration: none;
text-shadow: 0px 1px 0px #2f6627;
transition: all 0.3s ease;
}
.myButtonBig:hover {
background: linear-gradient(to bottom, #5cbf2a 5%, #44c767 100%);
background-color: #5cbf2a;
border-color: #137c21;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.myButtonBig:active {
position: relative;
top: 1px;
background: linear-gradient(to bottom, #3ba052 5%, #4aa62b 100%);
background-color: #3ba052;
border-color: #0f5c18;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
.myButton {
background: linear-gradient(to bottom, #44c767 5%, #5cbf2a 100%);
background-color: #44c767;
border-radius: 28px;
border: 1px solid #18ab29;
display: inline-block;
cursor: pointer;
color: #ffffff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 17px;
font-weight: bold;
padding: 16px 31px;
text-decoration: none;
text-shadow: 0px 1px 0px #2f6627;
transition: all 0.3s ease;
}
.myButton:hover {
background: linear-gradient(to bottom, #5cbf2a 5%, #44c767 100%);
background-color: #5cbf2a;
border-color: #137c21;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.myButton:active {
position: relative;
top: 1px;
background: linear-gradient(to bottom, #3ba052 5%, #4aa62b 100%);
background-color: #3ba052;
border-color: #0f5c18;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
/* Remove white space for title-text model when no image */
.column[data-model="title-text"]:not(:has(.content-image)) {
min-height: 0 !important;
padding-bottom: 0 !important;
}
/* Adjust for title-text model without image */
.column[data-model="title-text"]:not(:has(.content-image)) .generic-content {
margin-bottom: 0 !important;
}
.welcome-image {
max-width: 100%;
height: auto;
margin: 1em auto;
display: block;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.video-embed {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
margin: 0 auto !important;
max-width: 800px;
background: none;
text-align: center !important;
}
.video-embed iframe {
position: absolute;
top: 0;
left: 50% !important;
transform: translateX(-50%) !important;
width: 100% !important;
height: 100%;
max-width: 100% !important;
border: 0;
display: block !important;
}
.separator {
text-align: center;
margin: 40px 0 20px 0;
}
.separator-image {
max-width: 100%;
height: auto;
display: block;
margin: 0 auto;
z-index: 1;
}
/* V4.27: Adjust separator image position */
.main__right .separator-image {
position: absolute;
left: 50%;
transform: translateX(-50%);
top: 20px; /* V4.27: Shift down from title */
}
.separator img[src$="down_arrow.png"] {
max-width: 256px;
}
.content__entry.content__entry--full:first-child {
min-height: 0 !important;
padding-top: 0 !important;
margin-top: 0 !important;
}
.main.page .main__right:first-child {
margin-top: -3.8rem !important;
}
.banner--after-content {
margin: 0 !important;
padding: 0 !important;
border: none !important;
outline: none !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
@media (max-width: 768px) {
.main.page .main__right:first-child {
margin-top: 0 !important;
margin-bottom: 0 !important;
}
.main.page .container:first-child,
.main.page .post__entry:first-child {
margin: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.main.page .main__right .main__right--bottom:first-child {
margin-top: -3.8rem !important;
margin-bottom: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.main.page .container > .main__right > .main__right--bottom:first-child,
.main.page .post__entry > .main__right > .main__right--bottom:first-child {
margin: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.banner--after-content {
margin: 0 !important;
padding: 0 !important;
border: none !important;
outline: none !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
}
@media (min-width: 769px) and (max-width: 1023px) {
.main.page .main__right {
margin: 0 auto !important;
max-width: 90% !important;
width: auto !important;
}
.main.page .main__right .content__entry--full {
margin: 0 auto !important;
max-width: 100% !important;
}
.main.page .main__right .main__right--bottom {
margin: 0 auto !important;
max-width: 100% !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
}
.main.page .main__right .main__right--bottom .section-hero--full:first-child {
margin-top: 0 !important;
padding-top: 0 !important;
}
.content__entry.content__entry--full .separator:first-child {
margin-top: 0;
}
.section-hero--full:not([style*="background-image"]) + .separator {
margin-top: 40px;
}
hr {
display: none !important;
visibility: hidden !important;
}
.post__content hr,
.container hr,
.post__content hr[style],
.container hr[style] {
display: none !important;
visibility: hidden !important;
}
.post__content::before,
.post__content::after,
.container::before,
.container::after,
.post__entry::before,
.post__entry::after,
.content__entry::before,
.content__entry::after,
.generic-content::before,
.generic-content::after {
display: none !important;
border: none !important;
content: none !important;
}
.separator::before,
.separator::after {
display: none !important;
border: none !important;
content: none !important;
}
body,
body p,
body h2,
body h3,
body h4,
body h5,
body h6,
.post__content,
.post__content p,
.post__content h2,
.post__content h3,
.post__content h4,
.post__content h5,
.post__content h6,
.container,
.container p,
.container h2,
.container h3,
.container h4,
.container h5,
.container h6 {
color: #333 !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
h1.post__title,
h1.hero__title,
h1.site__title {
color: #fff !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
a.button,
a.btn,
a.post__button,
.post__content a.button,
.post__content a.btn,
.post__content a.post__button,
.container a.button,
.container a.btn,
.container a.post__button {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Custom Modal Styles */
.modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.5);
}
.modal-content {
background-color: #fff;
margin: 5% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 800px;
min-height: 200px;
position: relative;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
box-sizing: border-box;
}
.modal-close {
color: #aaa;
position: absolute;
top: 10px;
right: 20px;
font-size: 28px;
font-weight: bold;
cursor: pointer;
transition: color 0.3s ease;
z-index: 1001;
}
.modal-close:hover,
.modal-close:focus {
color: #000;
text-decoration: none;
}
#modal-body {
font-size: 1em;
line-height: 1.6;
color: #333;
max-width: 100%;
box-sizing: border-box;
padding-top: 40px;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
overflow-x: hidden;
}
#modal-body h1 {
font-size: 1.5em;
margin-bottom: 0.5em;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
#modal-body p {
margin-bottom: 1em;
}
#modal-body * {
max-width: 100%;
height: auto;
box-sizing: border-box;
}
#modal-body img,
#modal-body div,
#modal-body table {
max-width: 100%;
height: auto;
}
#modal-body .welcome-image {
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.modal[aria-hidden="false"] {
display: block;
}
.modal-close:focus {
outline: 2px solid #44c767;
outline-offset: 2px;
}
/* Custom separator for modal sections */
.modal-section-separator {
text-align: center;
margin: 20px 0;
font-size: 24px;
line-height: 1;
color: #666;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.modal-section-separator::before {
.modal[aria-hidden="false"] {
display: block;
}
.modal-close:focus {
outline: 2px solid #44c767;
outline-offset: 2px;
}
content: "···";
}
/* Modal-specific content container */
.modal-story-content {
max-width: 100%;
margin: 0 auto;
padding: 20px;
box-sizing: border-box;
overflow-x: hidden;
}
.modal-story-content h1 {
font-size: 2rem;
margin-bottom: 1rem;
text-align: center;
}
.modal-story-content .content-image {
max-width: 100%;
margin: 1rem 0;
}
.modal-story-content .generic-content {
font-size: 1rem;
line-height: 1.6;
}
/* Hide background image in modal */
.modal .background-image-wrapper {
display: none !important;
}
/* Chaplaincy Admin specific overrides */
.report-container {
max-width: 100% !important;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.content__entry {
max-width: 100% !important;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
box-sizing: border-box !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.content__entry table.report-table {
width: 100% !important;
margin: 0 !important;
padding: 0 !important;
border-collapse: collapse !important;
box-sizing: border-box !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* PP Button Layout Adjustments */
@media (min-width: 769px) {
.layout-3-column.position-100 .section-hero--column {
flex: 1 0 32%;
max-width: 32%;
}
}
@media (max-width: 768px) {
.layout-3-column.position-100 .section-hero--column {
flex: 1 0 100%;
max-width: 100%;
}
}
.section-group.position-100,
.section-hero--full {
margin-top: 2em;
}
/* Remove shadow from section images */
.content-image img,
.welcome-image {
box-shadow: none !important;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
}
/* Ensure no border or other effects interfere */
.content-image,
.modal-image {
box-shadow: none !important;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
}
/* V4.21: Debug cleanup - hide debug messages */
div[style*="color: orange"],
div[style*="color: purple"],
div[style*="color: blue"],
div[style*="color: green"],
div[style*="color: red"],
div[style*="Debug"] {
display: none !important;
visibility: hidden !important;
}
margin-left: -60px and width: 125% to fix Edge overflow, avoiding unnecessary centering adjustments.clear: both to .main__right .content__entry to prevent floating into the left frame..main__right .separator-image with top: 20px to move it below the title.Please test V4.27 and let me know if the layout stabilizes or if further tweaks are needed! If the Edge overflow persists, we can experiment with margin-left values between -60px and -70px.
Background image is showing perfect now on Edge desktop view, but a white margin remains at the right. I think we can set a wider width for the bkg image, say 140% to see if we can make it appearing wider. The default divider is now located back to the left of the action button above it in desktop view. In mobile view, the entire main_right frame is still overflowing the browser window at the right side (See attached image). I think we should focus to fix the mobile view alignment first and leave the divider for the next step after everything is proper centered. One important observation: If the content is properly centered the divider is actually well-centered. There is no need to move it.
The right margin on Edge is removed but the mobile view is still cut off. My understanding is the main_right frame should be taking 100% width of the mobile browser or 100% width of the main_right frame on desktop view, so there should not be any cut-off issue. But I see different alignment of the main_right content on different browser widths. Can you study the live demo site of the theme I'm using at https://demo.getpublii.eu/themes/square/ and explain how does the theme itself work and propose fix before generating the code?
This version is slightly better in the sense that the right cut-off in mobile view is less serious, just about half of a Chinese character in a typical phone width. I think we can try tweaking this a bit further. I think your analysis of the theme behaviour is very helpful. As a precaution, I wonder if we can develop the CSS from scratch in the future to make things more robust. I can remove the default CSS from the theme and rely solely on the custom one. For the time being, let's work on V4.31 of the custom CSS first.
This fix has revert background image to its previous state of looking just like a normal image without filling up the entire width, though the cut-off of content is improved in mobile view. Strangely, in desktop view about a third of a Chinese character get cut off. Can we revert the background display at least as we figure out how to center the main_right content responsively?
This reverts the background image again to the normal image look and the right-side content cut-off issue re-appears in desktop view. The mobile view looks very good and all elements including the divider are centered properly. I think upcoming fixes can skip the mobile view.
This version still has no differences on the background image look and the cut-off from desktop view. From earlier analysis on the Publii theme, why it seems that the "filling up the container" approach doesn't work but the negative margin approach has always affected how main_right is aligned?
left: 0; right: 0; width: auto) didn’t change the background image look, and the negative margin approach from earlier versions (e.g., margin-left: -65px; width: 130%) impacted .main__right alignment, it’s clear we need to revisit the Publii theme’s structure and constraints. Let’s analyze why this happens and propose a targeted fix for V4.37.The Publii theme likely uses a grid or flex-based layout for .main.page, with .main__left and .main__right as siblings, and .section-hero--full as a child of .main__right. Here’s why the approaches differ:
"Filling Up the Container" Failure: Setting left: 0; right: 0; width: auto on .background-image-wrapper assumes .section-hero--full acts as the positioning context with full width. However, if Publii applies a max-width (e.g., via .main__right or a parent container like .container) or constrains .section-hero--full’s dimensions, the background won’t stretch beyond that limit. The z-index: -1 might also be ignored if the parent’s overflow is hidden or if the background image is treated as a static element by the theme’s rendering.
Negative Margin Impact: The earlier approach (margin-left: -65px; width: 130%) worked partially because it artificially extended the background beyond .section-hero--full’s boundaries, but it disrupted .main__right alignment. This suggests .main__right’s layout (possibly a flex or float system) is sensitive to child element offsets, causing misalignment when negative margins pull the background outside its natural container. The theme might recalculate .main__right’s width or padding based on child positioning, leading to the cut-off.
Desktop Cut-Off Persistence: The right-side cut-off (about a third of a Chinese character) likely stems from .main__right’s max-width not accounting for font rendering (Chinese characters often require more horizontal space due to their width) or from padding/margin stacking within .section-hero__content. Increasing max-width and padding-right hasn’t worked, indicating a theme-imposed constraint (e.g., a fixed max-width on .main__right or .content__entry).
Theme Constraints: Publii’s default CSS likely sets a max-width on .main__right (e.g., 64rem or a percentage) and may use overflow: hidden or a flex container that clips content. The .background-image-wrapper might be nested in a way that limits its ability to expand, and .section-hero--full’s position: relative might not fully override the parent context.
margin-left: -65px; width: 130%) but isolate it to .background-image-wrapper with a wrapper div to prevent affecting .main__right alignment. Add a new .background-wrapper div around .background-image-wrapper with position: relative; width: 100%; to control the context, ensuring the background stretches without shifting .main__right..main__right max-width to calc(64rem + 100px) and add box-sizing: border-box with overflow-x: visible temporarily to diagnose, then adjust padding. Add word-break: break-all to .section-hero__content to handle Chinese character overflow..main.page .main__right .section-hero--full .background-image-wrapper) and !important to force changes past Publii’s defaults./* Custom CSS for Lifenavi (navi.claudioflute.live) and Chaplaincy Admin (admin.nlt-chaplaincy.org) - Version 4.37 */
/* V4.37: Revert to negative margin for background, fix desktop cut-off with wrapper (11:25 PM HKT, Sep 23, 2025) */
/* Debug: If you see this comment in browser inspector, custom.css is loaded correctly */
body {
font-family: "LXGW WenKai TC", "Times New Roman", serif;
box-sizing: border-box; /* V4.33: Universal box-sizing */
}
.font-test {
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 24px;
color: red;
}
.main__right .content__entry {
position: relative;
padding: 20px;
min-height: 200px;
margin: 0 auto;
max-width: none !important; /* V4.25: Stronger override for --entry-width */
--entry-width: unset !important; /* V4.25: Ensure theme variable is unset */
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-color: #fff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
box-sizing: border-box;
clear: both; /* V4.27: Prevent overlap with left frame */
overflow-x: hidden; /* V4.34: Clip overflow */
}
div.content__entry:empty {
display: none;
}
html, body {
overflow-x: hidden;
width: 100%;
margin: 0;
padding: 0;
box-sizing: border-box; /* V4.33: Universal box-sizing */
}
.main.page, .container, .post__entry {
width: 100%;
max-width: 100%;
margin: 0;
padding: 0;
box-sizing: border-box;
overflow-x: hidden;
}
/* V4.28: Increase z-index to overlay right frame */
.main__left {
z-index: 1;
}
/* Add background wrapper to isolate negative margin effect */
.main.page .main__right .section-hero--full {
position: relative;
}
.main.page .main__right .section-hero--full .background-wrapper {
position: relative;
width: 100%;
overflow: hidden;
}
@media (min-width: 1024px) {
.main.page .main__right {
max-width: calc(64rem + 100px) !important; /* V4.37: Increased buffer */
margin: 0 auto;
padding: 0 20px 0 20px !important; /* V4.37: Restore padding */
box-sizing: border-box;
overflow-x: visible; /* V4.37: Temporary to diagnose */
}
}
@media (max-width: 1023px) {
.main.page .main__right {
width: 100vw !important; /* V4.31: Full viewport */
max-width: 100% !important; /* V4.34: Simplify */
margin: 0 auto !important; /* V4.32: Center responsively */
padding: 0 2px !important; /* V4.34: Minimal padding */
overflow-x: hidden !important; /* V4.29: Ensure no overflow */
--entry-width: 100% !important; /* V4.30: Unset for fluid mobile */
}
}
@media (min-width: 768px) and (max-width: 1023px) {
.main.page .main__right {
max-width: calc(64rem + 100px) !important; /* V4.37: Adjust for padding */
margin: 0 auto !important;
padding: 0 20px 0 20px !important; /* V4.37: Restore padding */
}
.main.page .main__right .section-hero--full .background-wrapper .background-image-wrapper {
left: 0 !important; /* V4.37: Reset */
margin-left: -65px !important; /* V4.37: Revert negative margin */
width: 130% !important; /* V4.37: Restore width */
right: -10px !important; /* V4.37: Restore offset */
}
.content-embed .video-embed,
.content-embed-container .video-embed {
max-width: 800px !important; /* V4.25: Match desktop */
}
}
.section-hero--full {
width: 100%;
margin: 0 auto;
padding: 20px 0;
position: relative; /* V4.34: Anchor background */
min-height: 200px;
background-color: #fff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
overflow: hidden !important; /* V4.31: Prevent overflow */
box-sizing: border-box;
}
.section-hero--full .section-hero__content {
margin: 0 clamp(10px, 5vw, 45px) !important; /* V4.30: Responsive margin */
padding: 0;
box-sizing: border-box;
max-width: none !important; /* V4.25: Override theme constraint */
--entry-width: unset !important; /* V4.25: Unset theme variable */
width: 100% !important; /* V4.25: Ensure full width */
overflow-x: hidden !important; /* V4.37: Clip overflow */
word-break: break-all; /* V4.37: Handle Chinese character overflow */
}
.section-hero--full .column {
position: relative !important;
min-height: 200px;
overflow: visible !important;
z-index: 0;
}
.section-hero--full .section-hero__content,
.section-hero--full .column {
position: relative;
min-height: 200px;
overflow: visible;
}
/* V4.37: Revert to negative margin with wrapper */
.main.page .main__right .section-hero--full .background-wrapper .background-image-wrapper {
position: absolute !important;
top: -30px !important;
left: 0 !important; /* V4.37: Reset */
margin-left: -65px !important; /* V4.37: Revert negative margin */
width: 130% !important; /* V4.37: Restore width */
right: -10px !important; /* V4.37: Restore offset */
height: calc(100% + 40px) !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
z-index: -2 !important;
opacity: 0.8 !important;
visibility: visible !important;
display: block !important;
box-sizing: border-box !important;
}
.section-hero--full .column .background-wrapper .background-image-wrapper {
position: absolute !important;
top: -30px !important;
left: 0 !important; /* V4.37: Consistent */
margin-left: -65px !important; /* V4.37: Consistent margin */
width: 130% !important; /* V4.37: Consistent width */
right: -10px !important; /* V4.37: Consistent offset */
height: calc(100% + 40px) !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
z-index: -2 !important;
opacity: 0.8 !important;
visibility: visible !important;
display: block !important;
box-sizing: border-box !important;
}
@media (min-width: 768px) {
.main.page .main__right .section-hero--full .background-wrapper .background-image-wrapper {
position: absolute !important;
top: -30px !important;
left: 0 !important; /* V4.37: Desktop fix */
margin-left: -65px !important; /* V4.37: Desktop fix */
width: 130% !important; /* V4.37: Desktop fix */
right: -10px !important;
height: calc(100% + 40px) !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
z-index: -2 !important;
opacity: 0.8 !important;
visibility: visible !important;
display: block !important;
box-sizing: border-box !important;
}
}
@media (max-width: 767px) {
.section-hero--full .column .background-image-wrapper {
position: absolute !important;
top: -15px !important;
left: 0 !important; /* V4.34: Reset for mobile */
margin-left: 0 !important; /* V4.30: No negative margin */
width: 100% !important; /* V4.30: Full viewport fit */
transform: none !important; /* V4.30: Reset for centering */
height: calc(100% + 30px) !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
z-index: -2 !important;
opacity: 0.8 !important;
visibility: visible !important;
display: block !important;
box-sizing: border-box !important;
}
.section-hero--full .content__buttons::after {
height: 15px;
}
.section-hero--full .section-hero__content {
margin: 0 !important; /* V4.34: Remove margin */
padding: 0 1px !important; /* V4.34: Minimal padding */
max-width: 100vw !important; /* V4.31: Cap at viewport */
width: 100% !important; /* V4.34: Ensure full width */
}
/* V4.34: Restore mobile frame fit */
.main.page .main__right {
width: 100vw !important; /* V4.30: Viewport full */
max-width: 100% !important;
margin: 0 auto !important; /* V4.32: Center responsively */
padding: 0 2px !important; /* V4.34: Restore padding */
overflow-x: hidden !important;
box-sizing: border-box !important;
--entry-width: 100% !important; /* V4.30: Full flow */
}
.section-hero--full {
padding: 10px 0 !important; /* V4.30: Reduce vertical space */
overflow: hidden !important;
}
}
.section-hero--full .background-wrapper .background-image-wrapper,
.section-hero--full .column .background-wrapper .background-image-wrapper {
position: absolute !important;
top: -30px !important;
left: 0 !important; /* V4.37: Unified */
margin-left: -65px !important; /* V4.37: Unified fix */
width: 130% !important; /* V4.37: Unified fix */
right: -10px !important;
height: calc(100% + 40px) !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
z-index: -2 !important;
opacity: 0.8 !important;
visibility: visible !important;
display: block !important;
box-sizing: border-box !important;
}
.section-hero--full:has(.background-image-wrapper) h1,
.section-hero--full:has(.background-image-wrapper) .generic-content {
color: #fff !important;
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}
/* V4.25: YouTube centering with responsive override */
.content-embed,
.content-embed-container {
text-align: center !important;
margin: 0 auto !important;
max-width: 100% !important;
width: 100% !important;
box-sizing: border-box !important;
}
.content-embed .video-embed,
.content-embed-container .video-embed {
position: relative !important;
display: inline-block !important;
width: 100% !important;
max-width: 100vw !important; /* V4.25: Responsive cap */
padding-bottom: 56.25% !important; /* 16:9 aspect ratio */
margin: 0 auto !important;
overflow: hidden !important;
}
.content-embed .video-embed iframe,
.content-embed-container .video-embed iframe {
position: absolute !important;
top: 0 !important;
left: 50% !important;
transform: translateX(-50%) !important;
width: 100% !important; /* V4.25: Override YouTube pixel width */
height: 100% !important; /* V4.25: Override YouTube pixel height */
max-width: 100% !important;
border: 0 !important;
display: block !important;
box-sizing: border-box !important;
}
@media (max-width: 767px) {
.content-embed .video-embed,
.content-embed-container .video-embed {
max-width: 100% !important; /* V4.25: Mobile adjustment */
padding-bottom: 56.25% !important;
}
.content-embed .video-embed iframe,
.content-embed-container .video-embed iframe {
max-width: 100vw !important;
}
}
/* V4.25: Remove unexpected PayPal border */
.paypal-button {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
/* Preserve existing layout and other styles */
.section-hero--column {
flex: 1;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
padding: 10px;
}
.section-group {
display: flex;
flex-wrap: nowrap;
gap: 20px;
max-width: 1200px;
margin: 0 auto;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.layout-2-column {
display: flex;
justify-content: space-between;
}
.layout-2-column .section-hero--column {
flex: 1 0 49%;
max-width: 49%;
}
.layout-3-column {
display: flex;
justify-content: space-between;
}
.layout-3-column .section-hero--column {
flex: 1 0 32%;
max-width: 32%;
}
@media (min-width: 768px) {
.section-hero--full.layout-2-column .section-hero__content {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
}
.section-hero--full.layout-3-column .section-hero__content {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 20px;
}
.column {
width: 100%;
position: relative;
min-height: 0;
}
.content-embed {
width: 300px;
margin: 0 auto !important;
}
.paypal-button {
width: 300px !important;
max-width: 300px !important;
box-sizing: border-box;
margin: 0 auto;
}
}
@media (max-width: 767px) {
.section-hero--full .section-hero__content {
display: block;
}
.column {
margin-bottom: 20px;
width: 100%;
position: relative;
min-height: 0;
}
.content-embed {
width: 100% !important;
margin: 0 auto !important;
}
.paypal-button {
width: 100% !important;
max-width: none !important;
}
.content__buttons {
text-align: center !important;
}
}
.align-left {
text-align: left;
}
.content-image.align-left, .video-embed.align-left {
margin: 1em 0;
}
.align-center {
text-align: center;
}
h1, h2, h3, h4, h5, h6 {
font-family: "LXGW WenKai TC", "Times New Roman", serif !important;
margin-bottom: 1.5em !important;
}
.content__entry h1 {
font-size: 2em;
font-weight: 700;
line-height: 1.2;
color: #333;
margin-bottom: 1.5em !important;
padding-top: 1em;
text-align: center;
text-shadow: none;
font-family: "LXGW WenKai TC", "Times New Roman", serif !important;
}
.generic-content {
margin: 0 auto;
max-width: 800px;
font-size: 1em;
line-height: 1.6;
color: #333;
margin-bottom: 1em;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.generic-content p {
margin: 0 0 1em 0;
}
.generic-content ul,
.generic-content ol {
margin: 0 0 1em 0;
padding: 0 !important;
list-style: none !important;
}
.generic-content li {
margin-bottom: 0.5em;
text-align: inherit;
list-style: none !important;
}
.generic-content ul[style*="list-style"],
.generic-content ol[style*="list-style"],
.generic-content li[style*="list-style"] {
list-style: none !important;
}
.content__buttons {
text-align: center !important;
margin: 2em 0 1em 0;
}
.content__buttons a.myButton {
display: inline-block;
margin: 0 auto;
}
.content__entry .content__buttons {
text-align: center !important;
}
/* Button Styles */
.content__buttons a.myButton {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
a.myButtonBig {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.myButtonBig {
background: linear-gradient(to bottom, #44c767 5%, #5cbf2a 100%);
background-color: #44c767;
border-radius: 28px;
border: 1px solid #18ab29;
display: inline-block;
cursor: pointer;
color: #ffffff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 21px;
font-weight: bold;
padding: 24px 42px;
text-decoration: none;
text-shadow: 0px 1px 0px #2f6627;
transition: all 0.3s ease;
}
.myButtonBig:hover {
background: linear-gradient(to bottom, #5cbf2a 5%, #44c767 100%);
background-color: #5cbf2a;
border-color: #137c21;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.myButtonBig:active {
position: relative;
top: 1px;
background: linear-gradient(to bottom, #3ba052 5%, #4aa62b 100%);
background-color: #3ba052;
border-color: #0f5c18;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
.myButton {
background: linear-gradient(to bottom, #44c767 5%, #5cbf2a 100%);
background-color: #44c767;
border-radius: 28px;
border: 1px solid #18ab29;
display: inline-block;
cursor: pointer;
color: #ffffff;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
font-size: 17px;
font-weight: bold;
padding: 16px 31px;
text-decoration: none;
text-shadow: 0px 1px 0px #2f6627;
transition: all 0.3s ease;
}
.myButton:hover {
background: linear-gradient(to bottom, #5cbf2a 5%, #44c767 100%);
background-color: #5cbf2a;
border-color: #137c21;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.myButton:active {
position: relative;
top: 1px;
background: linear-gradient(to bottom, #3ba052 5%, #4aa62b 100%);
background-color: #3ba052;
border-color: #0f5c18;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
/* Remove white space for title-text model when no image */
.column[data-model="title-text"]:not(:has(.content-image)) {
min-height: 0 !important;
padding-bottom: 0 !important;
}
/* Adjust for title-text model without image */
.column[data-model="title-text"]:not(:has(.content-image)) .generic-content {
margin-bottom: 0 !important;
}
.welcome-image {
max-width: 100%;
height: auto;
margin: 1em auto;
display: block;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.video-embed {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
margin: 0 auto !important;
max-width: 800px;
background: none;
text-align: center !important;
}
.video-embed iframe {
position: absolute;
top: 0;
left: 50% !important;
transform: translateX(-50%) !important;
width: 100% !important;
height: 100%;
max-width: 100% !important;
border: 0;
display: block !important;
}
.separator {
text-align: center;
margin: 40px 0 20px 0;
}
/* V4.28: Simplify divider alignment like action buttons */
.separator-image {
max-width: 100%;
height: auto;
display: block;
margin: 0 auto;
text-align: center;
}
.separator img[src$="down_arrow.png"] {
max-width: 256px;
}
.content__entry.content__entry--full:first-child {
min-height: 0 !important;
padding-top: 0 !important;
margin-top: 0 !important;
}
.main.page .main__right:first-child {
margin-top: -3.8rem !important;
}
.banner--after-content {
margin: 0 !important;
padding: 0 !important;
border: none !important;
outline: none !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
@media (max-width: 768px) {
.main.page .main__right:first-child {
margin-top: 0 !important;
margin-bottom: 0 !important;
}
.main.page .container:first-child,
.main.page .post__entry:first-child {
margin: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.main.page .main__right .main__right--bottom:first-child {
margin-top: -3.8rem !important;
margin-bottom: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.main.page .container > .main__right > .main__right--bottom:first-child,
.main.page .post__entry > .main__right > .main__right--bottom:first-child {
margin: 0 !important;
padding: 0 !important;
border: 0 !important;
min-height: 0 !important;
}
.banner--after-content {
margin: 0 !important;
padding: 0 !important;
border: none !important;
outline: none !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
}
@media (min-width: 769px) and (max-width: 1023px) {
.main.page .main__right {
margin: 0 auto !important;
max-width: calc(64rem + 100px) !important; /* V4.37: Adjust for padding */
padding: 0 20px 0 20px !important; /* V4.37: Restore padding */
}
.main.page .main__right .content__entry--full {
margin: 0 auto !important;
max-width: 100% !important;
}
.main.page .main__right .main__right--bottom {
margin: 0 auto !important;
max-width: 100% !important;
}
.top__item--right {
border: none !important;
outline: none !important;
box-shadow: none !important;
}
.main.page .main__right .section-hero--full .background-wrapper .background-image-wrapper {
left: 0 !important; /* V4.37: Reset */
margin-left: -65px !important; /* V4.37: Revert negative margin */
width: 130% !important; /* V4.37: Restore width */
right: -10px !important; /* V4.37: Restore offset */
}
}
.main.page .main__right .main__right--bottom .section-hero--full:first-child {
margin-top: 0 !important;
padding-top: 0 !important;
}
.content__entry.content__entry--full .separator:first-child {
margin-top: 0;
}
.section-hero--full:not([style*="background-image"]) + .separator {
margin-top: 40px;
}
hr {
display: none !important;
visibility: hidden !important;
}
.post__content hr,
.container hr,
.post__content hr[style],
.container hr[style] {
display: none !important;
visibility: hidden !important;
}
.post__content::before,
.post__content::after,
.container::before,
.container::after,
.post__entry::before,
.post__entry::after,
.content__entry::before,
.content__entry::after,
.generic-content::before,
.generic-content::after {
display: none !important;
border: none !important;
content: none !important;
}
.separator::before,
.separator::after {
display: none !important;
border: none !important;
content: none !important;
}
body,
body p,
body h2,
body h3,
body h4,
body h5,
body h6,
.post__content,
.post__content p,
.post__content h2,
.post__content h3,
.post__content h4,
.post__content h5,
.post__content h6,
.container,
.container p,
.container h2,
.container h3,
.container h4,
.container h5,
.container h6 {
color: #333 !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
h1.post__title,
h1.hero__title,
h1.site__title {
color: #fff !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
a.button,
a.btn,
a.post__button,
.post__content a.button,
.post__content a.btn,
.post__content a.post__button,
.container a.button,
.container a.btn,
.container a.post__button {
text-decoration: none !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* Custom Modal Styles */
.modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.5);
}
.modal-content {
background-color: #fff;
margin: 5% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 800px;
min-height: 200px;
position: relative;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
box-sizing: border-box;
}
.modal-close {
color: #aaa;
position: absolute;
top: 10px;
right: 20px;
font-size: 28px;
font-weight: bold;
cursor: pointer;
transition: color 0.3s ease;
z-index: 1001;
}
.modal-close:hover,
.modal-close:focus {
color: #000;
text-decoration: none;
}
#modal-body {
font-size: 1em;
line-height: 1.6;
color: #333;
max-width: 100%;
box-sizing: border-box;
padding-top: 40px;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
overflow-x: hidden;
}
#modal-body h1 {
font-size: 1.5em;
margin-bottom: 0.5em;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
#modal-body p {
margin-bottom: 1em;
}
#modal-body * {
max-width: 100%;
height: auto;
box-sizing: border-box;
}
#modal-body img,
#modal-body div,
#modal-body table {
max-width: 100%;
height: auto;
}
#modal-body .welcome-image {
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.modal[aria-hidden="false"] {
display: block;
}
.modal-close:focus {
outline: 2px solid #44c767;
outline-offset: 2px;
}
/* Custom separator for modal sections */
.modal-section-separator {
text-align: center;
margin: 20px 0;
font-size: 24px;
line-height: 1;
color: #666;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.modal-section-separator::before {
content: "···";
}
/* Modal-specific content container */
.modal-story-content {
max-width: 100%;
margin: 0 auto;
padding: 20px;
box-sizing: border-box;
overflow-x: hidden;
}
.modal-story-content h1 {
font-size: 2rem;
margin-bottom: 1rem;
text-align: center;
}
.modal-story-content .content-image {
max-width: 100%;
margin: 1rem 0;
}
.modal-story-content .generic-content {
font-size: 1rem;
line-height: 1.6;
}
/* Hide background image in modal */
.modal .background-image-wrapper {
display: none !important;
}
/* Chaplaincy Admin specific overrides */
.report-container {
max-width: 100% !important;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.content__entry {
max-width: 100% !important;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
box-sizing: border-box !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
.content__entry table.report-table {
width: 100% !important;
margin: 0 !important;
padding: 0 !important;
border-collapse: collapse !important;
box-sizing: border-box !important;
font-family: "LXGW WenKai TC", "Times New Roman", serif;
}
/* PP Button Layout Adjustments */
@media (min-width: 769px) {
.layout-3-column.position-100 .section-hero--column {
flex: 1 0 32%;
max-width: 32%;
}
}
@media (max-width: 768px) {
.layout-3-column.position-100 .section-hero--column {
flex: 1 0 100%;
max-width: 100%;
}
}
.section-group.position-100,
.section-hero--full {
margin-top: 2em;
}
/* Remove shadow from section images */
.content-image img,
.welcome-image {
box-shadow: none !important;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
}
/* Ensure no border or other effects interfere */
.content-image,
.modal-image {
box-shadow: none !important;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
}
/* V4.21: Debug cleanup - hide debug messages */
div[style*="color: orange"],
div[style*="color: purple"],
div[style*="color: blue"],
div[style*="color: green"],
div[style*="color: red"],
div[style*="Debug"] {
display: none !important;
visibility: hidden !important;
}
This version has the background images re-appearing as a normal image but content alignment has improved a lot. This shows again that we can't put the background image inside a container for the desktop view, probably because for some reasons the container can't fill up the entire width of the main_right frame. What do you think?
This does not help. Background images still look contained. Manually adjusting the margin and width in the inspect window confirms this. I wonder if we can try a more creative approach, such as treating the background image as page background, right aligning it and expanding it to fill up the width of the right frame and placing it behind everything, including the left frame? But I'm not sure how to control its height to that of the section.
Before testing this I want to know how do you avoid the container issue with this version?
The alignment is better but still not centered. Please take a look at the screenshot.
Before testing this, can you study the default CSS of the Pulii theme below so that we can avoid guessing what the theme is doing?
CSS Loading Order or Specificity:
.separator styles (e.g., .separator, hr { text-align: center; }) might be applied via a more specific selector or inline styles that our custom rules aren’t overriding, despite !important.<style> tags), those could take precedence.Parent Container Constraints:
.section-hero__content class has margin: 0 clamp(10px, 5vw, 45px) !important and width: 90% !important, creating a centered block within .section-hero--full. The .separator inside it inherits this constrained width, and our width: 100% !important might be relative to this 90% width, not the full .main__right.Element Structure:
.separator might contain an <img> (e.g., down_arrow.png) or .separator-image as an inline or inline-block element. The theme’s default .separator::before { content: "···"; ... } could be adding invisible spacing that offsets the image, and our content: none !important might not be applying due to a timing or specificity issue.Publii Rendering:
.separator with inline styles (e.g., style="margin-left: 20px;") or wrapping it in a way that bypasses our selectors. The inspect window would reveal this..main__right Layout: On desktop (min-width: 56.25em), .main__right is width: 60% with float: right, and its child divs have max-width: var(--entry-width) (62ch). Your max-width: none !important on .content__entry helps, but .section-hero__content’s width: 90% reintroduces a constraint..separator Default: The theme centers .separator but adds a ::before pseudo-element with letter-spacing: 1.265625rem and padding-left: 1.265625rem, which could push content rightward unless overridden..content__buttons uses text-align: center !important, and .myButton is display: inline-block, centered within its parent, likely benefiting from the full .main__right width due to its placement.To force .separator to match .content__buttons centering, we need to:
.section-hero__content constraint by adjusting its width and margin..separator content (e.g., <img> or .separator-image) with block-level centering.Replace or append the .separator-related section at the end of your V4.39 CSS with this:
/* Force separator alignment to match action buttons with maximum specificity */
.main__right .section-hero--full .section-hero__content .separator,
.main__right .content__entry .separator {
text-align: center !important;
margin: 2em 0 1em 0 !important;
width: 100% !important; /* Span full container */
display: block !important;
margin-left: 0 !important;
margin-right: 0 !important;
padding: 0 !important;
box-sizing: border-box !important;
position: relative !important;
z-index: 1 !important; /* Ensure it’s not hidden */
}
/* Suppress default pseudo-element to remove spacing interference */
.main__right .section-hero--full .section-hero__content .separator::before,
.main__right .content__entry .separator::before {
content: none !important;
display: none !important;
}
/* Center the separator image or content with full control */
.main__right .section-hero--full .section-hero__content .separator-image,
.main__right .content__entry .separator-image {
max-width: 100%;
height: auto;
display: block !important;
margin: 0 auto !important;
text-align: center !important;
}
.main__right .section-hero--full .section-hero__content .separator img[src$="down_arrow.png"],
.main__right .content__entry .separator img[src$="down_arrow.png"] {
max-width: 256px;
margin: 0 auto !important;
display: block !important;
box-sizing: border-box !important;
}
/* Override any inline styles from Publii editor */
.separator[style],
.separator-image[style],
.separator img[style] {
margin-left: auto !important;
margin-right: auto !important;
text-align: center !important;
width: auto !important; /* Reset any inline width */
}
/* Adjust parent container to remove width constraint */
.main__right .section-hero--full .section-hero__content {
margin: 0 !important; /* Remove clamp margin */
width: 100% !important; /* Full width of parent */
max-width: none !important; /* Override any theme max-width */
padding: 0 !important; /* Avoid padding interference */
box-sizing: border-box !important;
}
/* Hide default hr on desktop when no custom separator is present */
@media (min-width: 768px) {
.content__entry:not(:has(.separator)) hr,
.section-hero--full:not(:has(.separator)) hr {
display: none !important;
visibility: hidden !important;
}
}
/* Ensure default hr is visible in modal */
#modal-body hr,
.modal-content hr {
display: block !important;
visibility: visible !important;
margin: 2em 0 !important;
border: 0;
height: 1px;
background: #ccc;
}
/* Reinforce hiding default hr elsewhere */
hr {
display: none !important;
visibility: hidden !important;
}
.post__content hr,
.container hr,
.post__content hr[style],
.container hr[style] {
display: none !important;
visibility: hidden !important;
}
.main__right .section-hero--full .section-hero__content .separator to target the exact nesting, ensuring it overrides theme styles.display: none !important to .separator::before to fully suppress the "···" and its spacing..section-hero__content to margin: 0 !important; width: 100% !important; max-width: none !important; to remove the 90% width and clamp margin constraint, aligning it with .main__right’s full width..separator-image and <img> are display: block !important with margin: 0 auto !important, centering them within the full-width .separator..separator (and down_arrow.png) is now centered with .content__buttons. Use the inspect window to:
.section-hero__content has width: 100% and margin: 0..separator and its <img> have margin: 0 auto with equal computed left/right margins..separator has inline styles (e.g., style="margin-left: 20px;") or is wrapped in an unexpected parent..separator, .separator-image, .section-hero__content, and their parents..main__right .section-hero--full { width: 100% !important; } to ensure the parent isn’t constrained.style.css directly (e.g., remove max-width: var(--entry-width) from .main__right > div) or use JavaScript to adjust .separator’s position, though the latter is less ideal.Please test this and let me know the results or any specific findings from the inspect window. Current time is 10:55 AM HKT, September 24, 2025.
Can you review them in details and recap why we were able to extend bkg. image full width and centering content more easily? This should help us to determine the direction forward!
The history is in Q & A format separating by "#### Q:" and "#### A:". Note that not all stages of the coding process are included. If you see multiple questions without answers, it indicates that some of the less important stages have been omitted for clarity.
I think I didn't make it clear that I meant background positioning and content centering was easier for both AG-29 and AG-32 but has become more difficult from this chat and probably the one before. For example, we were able to extend the background image to full width at custom.css V4.9 despite the image look compressed. If we can find out some hints from the past we might not need to develop a custom theme. A more complete history can be reviewed at: https://x.com/i/grok/share/HXFz5j37fxmxy3667CcMNbpFb, if that's accessible to you.
width: 100vw !important, max-width: none !important, margin-left: 50% !important, margin-right: -50vw !important, and transform: translateX(-50%) on .section-hero--full[style*="background-image"] to extend the background to full viewport width and center it. background-size: contain !important preserved aspect ratio, though it introduced white spaces or compression.--entry-width: 62ch constraint and the nested max-width on .main__right > div. Content centering was achieved with margin: 1em auto on illustrations and text-align: center on elements like .content__buttons, leveraging the simplified frame sizing fixes (e.g., overflow-x: hidden on html, body)..section-hero--full’s min-height: 200px). This worked for basic layouts but failed when content (e.g., action buttons, separators) extended beyond the initial height, causing cut-offs or white edges, especially as sections grew dynamically with user content..background-image-wrapper’s height was tied to .section-hero--full’s min-height or a fixed value, which didn’t adapt to dynamic content (e.g., variable button heights, multi-line text)..section-hero__content with width: 90% !important and margin: 0 clamp(10px, 5vw, 45px) further complicated height calculations, as the wrapper needed to extend beyond this constrained area..background-image-wrapper { height: calc(100% + 40px) !important; } (V4.19) or left: 50%; transform: translateX(-50%) (V4.27) aimed to adjust height and centering but were inconsistent. The +40px buffer was a guess, often too short or excessive, leading to cut-offs or overflow..section-hero--full varied with content (e.g., buttons, separators, text blocks). Static CSS couldn’t calculate this in real-time, especially across responsive breakpoints (e.g., min-width: 768px).adjustBackground() in pull-contents.php V2.79 used section.getBoundingClientRect().height to measure the actual rendered height, adding a 40px buffer for buttons/separators. This was triggered on DOMContentLoaded, load, and resize, ensuring adaptability.
wrapper.style.height = (sectionHeight + 40) + 'px'; with a setTimeout delay (500ms) to account for DOM rendering delays.z-index: -2 and conditional opacity (e.g., 0.5 for patterns, 0.8 for images), JS could apply context-specific adjustments based on image type or section content, which CSS rules couldn’t handle dynamically.min-height: 200px sufficed. As AG-32 introduced richer sections (e.g., dynamic embeds, multi-element layouts), the static approach broke, necessitating JS to bridge the gap.100vw trick worked because .main__right’s width: 60% was the primary limit, easily overridden..section-hero__content’s width: 90% emerged later), reducing the need for specific overrides.The sudden reliance on JS reflects Publii’s evolving complexity (e.g., tighter container rules, dynamic content). Recently, we’ve struggled because:
.section-hero__content’s width: 90% and clamp margins require deeper selectors and parent fixes, undoing the broad 100vw simplicity.calc(100% + 40px) guesses wrong across devices.width: 100vw !important; transform: translateX(-50%) on .section-hero--full, testing if .section-hero__content’s constraints can be neutralized with width: 100% !important; margin: 0 !important without JS.height: calc(100% + 100px) !important) to cover most content, avoiding JS unless cut-offs occur.overflow rules post-AG-32 that might have tightened control, prompting JS reliance.Before testing the proposed CSS, let’s confirm:
.section-hero--full and .background-image-wrapper for current inline styles or parent overflow that might block 100vw.Try the simplified CSS below without JS initially:
.section-hero--full,
.section-hero--full .background-image-wrapper {
width: 100vw !important;
max-width: none !important;
margin-left: 50% !important;
margin-right: -50vw !important;
transform: translateX(-50%) !important;
position: relative !important;
height: calc(100% + 100px) !important; /* Test generous buffer */
}
.background-image-wrapper {
position: absolute !important;
top: 0 !important;
background-size: cover !important;
background-position: center !important;
z-index: -1 !important;
}
.section-hero--full .section-hero__content {
width: 100% !important;
margin: 0 !important;
text-align: center !important;
}
.separator,
.content__buttons {
text-align: center !important;
margin: 2em 0 1em 0 !important;
}
.separator img[src$="down_arrow.png"] {
max-width: 256px;
margin: 0 auto !important;
display: block !important;
}
Please check the inspect window and test this CSS. Let me know the results or any new constraints you find!
Copyright © 2023 Curation Web 我的資訊「展」輯. All Rights Reserved | Powered by Bludit | Theme by BlThemes