/**
 * Summit Mission Church - Global Responsive Board CSS
 * Applied to sketchbook5_MH
 * Purpose: make legacy XE/Rhymix posts responsive without editing each post.
 */

/* =========================================================
   1. Core box sizing and overflow protection
   ========================================================= */
.bd,
.bd *,
.board_content,
.board_content *,
#board_read,
#board_read * {
    box-sizing: border-box;
}

.bd,
.board_content,
#board_read,
.rd {
    max-width: 100%;
}

#board_read,
.rd_body,
.xe_content,
.rhymix_content {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* =========================================================
   2. Legacy images - never overflow the screen
   ========================================================= */
#board_read .xe_content img,
#board_read .rhymix_content img,
.rd_body .xe_content img,
.rd_body .rhymix_content img,
#board_read img[width],
#board_read img[style*="width"] {
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain;
}

/* Clamp legacy fixed-width blocks to the content area. */
#board_read .xe_content [style*="width"],
#board_read .rhymix_content [style*="width"] {
    max-width: 100% !important;
}

/* =========================================================
   3. Video, iframe, embed, object
   ========================================================= */
#board_read .xe_content video,
#board_read .rhymix_content video,
#board_read .xe_content embed,
#board_read .rhymix_content embed,
#board_read .xe_content object,
#board_read .rhymix_content object,
#board_read .xe_content iframe,
#board_read .rhymix_content iframe {
    max-width: 100% !important;
}

#board_read .xe_content video,
#board_read .rhymix_content video {
    width: 100% !important;
    height: auto !important;
}

/* Preserve a useful ratio for common video services. */
#board_read iframe[src*="youtube.com"],
#board_read iframe[src*="youtu.be"],
#board_read iframe[src*="youtube-nocookie.com"],
#board_read iframe[src*="vimeo.com"] {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
}

/* =========================================================
   4. Tables and wide legacy content
   ========================================================= */
#board_read .xe_content table,
#board_read .rhymix_content table {
    max-width: 100% !important;
}

#board_read .xe_content > div[style*="overflow-x"],
#board_read .rhymix_content > div[style*="overflow-x"] {
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* If a legacy table itself is wider than the viewport, allow horizontal scroll. */
@media screen and (max-width: 768px) {
    #board_read .xe_content table,
    #board_read .rhymix_content table {
        display: block;
        width: 100% !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-collapse: collapse;
    }

    #board_read .xe_content table tbody,
    #board_read .rhymix_content table tbody {
        max-width: 100%;
    }
}

/* =========================================================
   5. Long URLs, preformatted text, code
   ========================================================= */
#board_read .xe_content a,
#board_read .rhymix_content a {
    overflow-wrap: anywhere;
    word-break: break-word;
}

#board_read .xe_content pre,
#board_read .rhymix_content pre,
#board_read .xe_content code,
#board_read .rhymix_content code {
    max-width: 100%;
}

#board_read .xe_content pre,
#board_read .rhymix_content pre {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* =========================================================
   6. Attachments and forms
   ========================================================= */
.bd .file_lst,
.bd .rd_file,
.bd .rd_file ul,
.bd .rd_file li,
.bd .attachedFile,
.bd .attached_file {
    max-width: 100%;
}

.bd input,
.bd select,
.bd textarea {
    max-width: 100%;
}

/* =========================================================
   7. Mobile reading layout
   ========================================================= */
@media screen and (max-width: 768px) {
    .board_content {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .bd {
        width: 100% !important;
        max-width: 100% !important;
    }

    .bd .rd,
    #board_read .rd {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    #board_read .xe_content,
    #board_read .rhymix_content {
        width: 100% !important;
        max-width: 100% !important;
        font-size: 16px;
        line-height: 1.75;
    }

    #board_read .xe_content p,
    #board_read .rhymix_content p {
        max-width: 100% !important;
    }

    /* Old fixed-size image wrappers */
    #board_read .xe_content div,
    #board_read .rhymix_content div {
        max-width: 100%;
    }

    /* Prevent toolbar/meta areas from causing horizontal overflow */
    .rd_hd,
    .rd_hd *,
    .rd_nav,
    .rd_nav *,
    .bd_hd,
    .bd_hd * {
        max-width: 100%;
    }
}

/* =========================================================
   8. Small phones
   ========================================================= */
@media screen and (max-width: 480px) {
    .bd .rd,
    #board_read .rd {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    #board_read .xe_content,
    #board_read .rhymix_content {
        font-size: 15.5px;
        line-height: 1.72;
    }
}

/* ===== SMC PC FLUID WIDTH START ===== */
/*
 * Desktop/tablet fluid-width correction.
 * The first responsive version mainly corrected <=768px.
 * This block makes the same board fluid on PC as the viewport changes.
 */

/* All desktop board shells follow their available width */
.board_content,
.bd,
#board_read,
#board_read .rd {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

/* Main reading content follows the board width */
#board_read .rd_body,
#board_read .rhymix_content,
#board_read .xe_content,
.bd .rhymix_content,
.bd .xe_content {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

/* Common list styles also follow display width */
.bd .bd_lst,
.bd .bd_tb_lst,
.bd .bd_zine,
.bd .bd_gallery,
.bd .webzine,
.bd .list_wrap,
.bd .lst_wrap {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

/* Board list tables should use the available width on PC */
.bd table.bd_lst,
.bd .bd_tb_lst table,
.bd table.webzine {
    width: 100% !important;
    max-width: 100% !important;
}

/* Legacy images shrink whenever the desktop window becomes narrower */
#board_read .rhymix_content img,
#board_read .xe_content img,
.bd .rhymix_content img,
.bd .xe_content img {
    max-width: 100% !important;
    height: auto !important;
}

/* Wide embedded media */
#board_read iframe,
#board_read video,
#board_read embed,
#board_read object {
    max-width: 100% !important;
}

/* Desktop and tablet: keep comfortable fluid side padding */
@media screen and (min-width: 769px) {
    .board_content {
        padding-left: clamp(12px, 2vw, 32px) !important;
        padding-right: clamp(12px, 2vw, 32px) !important;
    }

    #board_read .rd {
        padding-left: clamp(14px, 2.2vw, 36px) !important;
        padding-right: clamp(14px, 2.2vw, 36px) !important;
    }

    /*
     * Old imported content often contains fixed width="..." or inline width.
     * Do not let those blocks force the entire desktop page wider.
     */
    #board_read .rhymix_content [style*="width"],
    #board_read .xe_content [style*="width"],
    #board_read .rhymix_content [width],
    #board_read .xe_content [width] {
        max-width: 100% !important;
    }
}

/* Narrow desktop / tablet landscape */
@media screen and (min-width: 769px) and (max-width: 1199px) {
    .board_content,
    .bd,
    #board_read,
    #board_read .rd {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Prevent optional metadata from making list tables too wide */
    .bd .bd_tb_lst td,
    .bd .bd_tb_lst th {
        white-space: normal !important;
    }
}
/* ===== SMC PC FLUID WIDTH END ===== */
/* SMC_ALL_BOARDS_NOTICE_MOBILE_FIX_20261115
   Keep the skin's normal mobile card layout; notices must use readable dark text on a light surface. */
@media screen and (max-width:768px) {
  body #smc-layout .bd table.bd_tb_lst tbody tr.notice,
  body #smc-layout .bd table.bd_tb_lst tbody tr.notice > td {
    background:#fffaf0 !important;
    background-color:#fffaf0 !important;
    background-image:none !important;
    color:#243447 !important;
    -webkit-text-fill-color:#243447 !important;
  }
  body #smc-layout .bd table.bd_tb_lst tbody tr.notice td.title a,
  body #smc-layout .bd table.bd_tb_lst tbody tr.notice td.title a *,
  body #smc-layout .bd table.bd_tb_lst tbody tr.notice td.author,
  body #smc-layout .bd table.bd_tb_lst tbody tr.notice td.author *,
  body #smc-layout .bd table.bd_tb_lst tbody tr.notice td.time,
  body #smc-layout .bd table.bd_tb_lst tbody tr.notice td.m_no {
    color:#243447 !important;
    -webkit-text-fill-color:#243447 !important;
    text-shadow:none !important;
  }
  body #smc-layout .bd table.bd_tb_lst tbody tr.notice td.no .sbtn-orange {
    color:#fff !important;
    -webkit-text-fill-color:#fff !important;
  }
}

/* SMC_MOBILE_BOARD_ROW_NUMBER_20261115: show the existing article number before its title on all mobile board lists. */
@media screen and (max-width:768px) {
  body #smc-layout .bd table.bd_tb_lst tbody tr {
    grid-template-columns:34px minmax(0,1fr) !important;
  }
  body #smc-layout .bd table.bd_tb_lst tbody td.no {
    display:block !important;
    grid-column:1 !important;
    grid-row:1 !important;
    align-self:start !important;
    text-align:center !important;
    font-size:12px !important;
    line-height:1.65 !important;
    color:#64748b !important;
    -webkit-text-fill-color:#64748b !important;
    white-space:nowrap !important;
  }
  body #smc-layout .bd table.bd_tb_lst tbody td.title {
    display:block !important;
    grid-column:2 !important;
    grid-row:1 !important;
  }
  body #smc-layout .bd table.bd_tb_lst tbody td.date {
    grid-column:2 !important;
    grid-row:2 !important;
  }
  body #smc-layout .bd table.bd_tb_lst tbody tr.notice td.no {
    color:#8b5c17 !important;
    -webkit-text-fill-color:#8b5c17 !important;
  }
}
