/* ========================================================================
   BBCODE CONTENT STYLING
   Styles for BBCode-generated HTML content displayed in site descriptions
   ======================================================================== */

div.sitenear-html-container {
    display: block;
    overflow: visible; /* code-notes contain large pictures and layout but let it be seen*/
    padding-right: 1rem;
    padding-left: 1rem;
    position: relative;
    padding-bottom: 1rem;
    line-height: 1.6;
    word-wrap: break-word;
}

div.sitenear-html-container  div.sitenear-rendered-alignment-block {
    width: 100%;
}

div.sitenear-html-container img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1em 0;
}

div.sitenear-html-container span,div.sitenear-html-container strong {
    display: inline-block;
    /*noinspection CssInvalidPropertyValue*/
    overflow-wrap:anywhere;
    word-break: break-word;
    text-align:justify;
}

.responsive-img {
    max-width: 100%;
    height: auto;
}

/* Lists - Unordered (bullets) */
div.sitenear-html-container ul {
    list-style-type: disc;
    list-style-position: outside;
    margin-left: 2em;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    padding-left: 0;
}

div.sitenear-html-container ul ul {
    list-style-type: circle;
    margin-top: 0.25em;
    margin-bottom: 0.25em;
}

div.sitenear-html-container ul ul ul {
    list-style-type: square;
}

/* Lists - Ordered (numbers) */
div.sitenear-html-container ol {
    list-style-type: decimal;
    list-style-position: outside;
    margin-left: 2em;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    padding-left: 0;
}

div.sitenear-html-container ol ol {
    list-style-type: lower-alpha;
    margin-top: 0.25em;
    margin-bottom: 0.25em;
}

div.sitenear-html-container ol ol ol {
    list-style-type: lower-roman;
}

/* List items */
div.sitenear-html-container li {
    margin-bottom: 0.25em;
    line-height: 1.6;
}

/* Tables */
div.sitenear-html-container table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 1em;
    margin-bottom: 1em;
}

div.sitenear-html-container table td,
div.sitenear-html-container table th {
    padding: 8px 12px;
    text-align: center;
    vertical-align: top;
}

div.sitenear-html-container table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

div.sitenear-html-container table tr:nth-child(even) {
    background-color: #f9f9f9;
}

div.sitenear-html-container table tr:hover {
    background-color: #f5f5f5;
}

/* Blockquotes */
div.sitenear-html-container blockquote {
    margin: 1em 0;
    padding: 0.5em 1em;
    border-left: 4px solid #ccc;
    background-color: #f9f9f9;
    font-style: italic;
}

div.sitenear-html-container blockquote cite {
    display: block;
    margin-top: 0.5em;
    font-style: normal;
    font-weight: bold;
    font-size: 0.9em;
}

div.sitenear-html-container blockquote cite:before {
    content: "— ";
}

/* Code blocks */
div.sitenear-html-container code {
    background-color: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

/* Horizontal rules */
div.sitenear-html-container hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 1.5em 0;
}

/* Text alignment (BBCode: [left], [center], [right], [justify]) */
div.sitenear-html-container div[align="left"] {
    text-align: left;
}

div.sitenear-html-container div[align="center"] {
    text-align: center;
}

div.sitenear-html-container div[align="right"] {
    text-align: right;
}

div.sitenear-html-container div[align="justify"] {
    text-align: justify;
}

/* Preserve line breaks in BBCode content */
div.sitenear-html-container br {
    display: block;
    content: "";
    margin-top: 0.5em;
}

/* Spacing for paragraphs (when BBCode generates divs) */
div.sitenear-html-container > div {
    margin-bottom: 0.5em;
}

/* YouTube/iframe embeds */
div.sitenear-html-container iframe {
    max-width: 100%;
    margin: 1em 0;
}

/* ========================================================================
   BACKGROUND SECTIONS
   Full-width background sections with optional overlay
   ======================================================================== */

/* Base section styling */
div.sitenear-html-container .sitenear-section {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 100%;
    padding: 3em 2em;
    margin: 1.5em 0;
    min-height: 200px;
    position: relative;
    display: block;
    border-radius: 8px;
    overflow: hidden;
    box-sizing: border-box;
}

/* Ensure content inside section is positioned correctly */
div.sitenear-html-container .sitenear-section > * {
    position: relative;
    z-index: 1;
}

/* Text contrast for sections with overlay */
div.sitenear-html-container .sitenear-section[data-overlay] {
    color: #ffffff;
}

/* Enhanced text shadow for better readability */
div.sitenear-html-container .sitenear-section[data-overlay] h1,
div.sitenear-html-container .sitenear-section[data-overlay] h2,
div.sitenear-html-container .sitenear-section[data-overlay] h3,
div.sitenear-html-container .sitenear-section[data-overlay] strong,
div.sitenear-html-container .sitenear-section[data-overlay] b {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Body text shadow */
div.sitenear-html-container .sitenear-section[data-overlay] {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Fallback for sections without background */
div.sitenear-html-container .sitenear-section-no-bg {
    padding: 2em;
    margin: 1em 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #f9f9f9;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    div.sitenear-html-container .sitenear-section {
        padding: 2em 1.5em;
        min-height: 150px;
        border-radius: 4px;
    }
}

@media (max-width: 480px) {
    div.sitenear-html-container .sitenear-section {
        padding: 1.5em 1em;
        min-height: 120px;
    }
}

/* Print styles - show content without background */
@media print {
    div.sitenear-html-container .sitenear-section {
        background-image: none !important;
        border: 1px solid #ddd;
        color: #000 !important;
        text-shadow: none !important;
    }
}

/* ========================================================================
   MULTI-IMAGE TABLE ROW
   Same height images side-by-side using flexbox with responsive clamp()
   Only applies to tables with MULTIPLE image-only cells (not image+text)
   ======================================================================== */

/* Target rows where BOTH first and second cells contain only an image */
div.sitenear-html-container table:has(tr:has(td:first-child > img:only-child):has(td:nth-child(2) > img:only-child)) {
    width: auto;
    margin: 1em auto;
    border: none !important;
    display: block;
    border-collapse: collapse;
}

div.sitenear-html-container table:has(tr:has(td:first-child > img:only-child):has(td:nth-child(2) > img:only-child)) tbody {
    display: block;
}

div.sitenear-html-container table:has(tr:has(td:first-child > img:only-child):has(td:nth-child(2) > img:only-child)) tr {
    display: flex;
    justify-content: center;
    gap: 1em;
}

div.sitenear-html-container table:has(tr:has(td:first-child > img:only-child):has(td:nth-child(2) > img:only-child)) td {
    border: none !important;
    padding: 0.5em;
    text-align: center;
}

/* Images in multi-image rows - same responsive height, centered */
div.sitenear-html-container tr:has(td:first-child > img:only-child):has(td:nth-child(2) > img:only-child) td > img:only-child {
    height: clamp(150px, 20vw, 280px);
    width: auto;
    max-width: 100%;
    display: block;
    margin: 0 auto;
}

/* Mobile - stack vertically with auto height */
@media (max-width: 480px) {
    div.sitenear-html-container table:has(tr:has(td:first-child > img:only-child):has(td:nth-child(2) > img:only-child)) tr {
        flex-direction: column;
        align-items: center;
    }

    div.sitenear-html-container tr:has(td:first-child > img:only-child):has(td:nth-child(2) > img:only-child) td > img:only-child {
        height: auto;
        max-width: 90%;
    }
}

/* ======================================================================== */