/* ==========================================================================
   About page (about.php) — scoped to body.about-page
   Loaded after site-theme.css. Layout/visual only; no content changes.
   ========================================================================== */

/* ---- Intro blocks (video + text) ---- */
.about-page .about-intro .row { align-items: center; }

.about-page .about-intro .ratio {
    border-radius: var(--site-radius);
    box-shadow: var(--site-shadow-hover);
}

.about-page .about-intro .col-lg-6:not(:first-child) {
    padding: 1.75rem 2rem;
    background: #fff;
    border: 1px solid var(--ssm-border);
    border-radius: var(--site-radius);
    box-shadow: var(--site-shadow);
}

@media (min-width: 992px) {
    .about-page .about-intro .col-lg-6:first-child { padding-right: 2rem !important; }
}

.about-page .about-intro h2 {
    position: relative;
    margin: 0 0 1rem;
    padding-left: 1rem;
    color: var(--ssm-primary) !important;
    font-size: clamp(1.35rem, 2.2vw, 1.75rem);
    font-weight: 700;
    line-height: 1.35;
}

.about-page .about-intro h2::before {
    position: absolute;
    top: .2em;
    bottom: .2em;
    left: 0;
    width: 5px;
    border-radius: 5px;
    background: linear-gradient(180deg, #8b3be0, var(--ssm-accent));
    content: "";
}

.about-page .about-intro p + h2 { margin-top: 1.75rem; }

.about-page .about-intro p {
    margin-bottom: .9rem;
    color: var(--ssm-muted);
    font-size: 1rem;
    line-height: 1.85;
}

.about-page .about-intro p:last-child { margin-bottom: 0; }

/* ---- People sections (founders + committee) ---- */
.about-page .about-people { padding: 4rem 0; }
.about-page .about-founders { background: var(--ssm-bg); }

.about-page .about-people h2 {
    position: relative;
    margin-bottom: 2.5rem !important;
    padding-bottom: 1rem;
    color: var(--ssm-primary) !important;
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    font-weight: 700;
}

.about-page .about-people h2::after {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 56px;
    height: 4px;
    margin-left: -28px;
    border-radius: 4px;
    background: var(--ssm-primary);
    content: "";
}

/* Founders: name cards in a grid */
.about-page .about-founders .list-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    margin-bottom: .75rem;
}

.about-page .about-founders .list-group-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .75rem .8rem;
    color: var(--ssm-dark);
    font-size: .95rem;
    background: #fff;
    border: 1px solid var(--ssm-border) !important;
    border-radius: 14px !important;
    font-weight: 500;
    line-height: 1.4;
    transition: transform .2s ease, box-shadow .2s ease;
}

.about-page .about-founders .list-group-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--site-shadow);
}

.about-page .about-founders .list-group-item::before {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 32px;
    height: 32px;
    color: var(--ssm-primary);
    background: var(--ssm-soft);
    border-radius: 50%;
    font-family: "Font Awesome 5 Free";
    font-size: .85rem;
    font-weight: 900;
    content: "\f007";
}

.about-page .about-founders .list-group-item > span:first-child { flex: 1; min-width: 0; }

/* The section title already says "ผู้ก่อตั้งมูลนิธิ": keep the badge for
   screen readers but hide it visually so each name fits on one line */
.about-page .about-founders .badge {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 575.98px) {
    .about-page .about-founders .list-group { grid-template-columns: 1fr; }
}

/* Committee: two panels */
.about-page .about-committee .row > .col-lg-6 {
    padding: 0 .75rem 1.5rem !important;
    border: 0 !important;
}

.about-page .about-committee .col-lg-6 > h4 {
    margin: 0 !important;
    padding: 1rem 1.25rem;
    color: #fff !important;
    background: linear-gradient(120deg, var(--ssm-primary-dark), var(--ssm-primary));
    border-radius: var(--site-radius) var(--site-radius) 0 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.about-page .about-committee .col-lg-6:first-child > h4 {
    background: linear-gradient(120deg, #4b3f72, var(--ssm-muted));
}

.about-page .about-committee .col-lg-6 > ol {
    margin: 0;
    padding: .5rem 1.25rem;
    background: #fff;
    border: 1px solid var(--ssm-border);
    border-top: 0;
    border-radius: 0 0 var(--site-radius) var(--site-radius);
    box-shadow: var(--site-shadow);
}

.about-page .about-committee li {
    gap: 1rem;
    margin: 0 !important;
    padding: .75rem 0 !important;
    color: var(--ssm-dark);
    border-bottom: 1px solid var(--ssm-border);
    line-height: 1.45;
}

.about-page .about-committee li:last-child { border-bottom: 0; }

/* Bootstrap 5's text-bg-* classes use !important, so these need it too */
.about-page .about-committee .badge {
    flex-shrink: 0;
    padding: .35em .75em;
    color: var(--ssm-primary) !important;
    background: var(--ssm-soft) !important;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    white-space: normal;
    text-align: right;
}

.about-page .about-committee .text-bg-warning {
    color: #9a5b00 !important;
    background: #fff3e0 !important;
}

.about-page .about-committee .col-lg-6:first-child .badge {
    color: var(--ssm-muted) !important;
    background: #efecf6 !important;
}

/* ---- "กว่าจะมาเป็น สสม." band ---- */
.about-page .about-band {
    padding: 5.5rem 0 5.5rem !important;
    overflow: hidden;
    background-color: var(--ssm-primary-dark);
}

.about-page .about-band::before {
    position: absolute;
    inset: 0;
    z-index: 0;
    /* first layer: top wave. It follows the SAME curve as the bottom wave
       (white above the curve), so both edges rise and fall together and the
       band reads as a ribbon of even thickness. */
    background:
        url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 96' preserveAspectRatio='none'%3e%3cpath fill='%23ffffff' fill-opacity='.18' transform='translate(0 14)' d='M0 -14 H1440 V65 C1280 40 1120 93 940 72 C780 52 655 44 465 66 C290 86 150 38 0 65 Z'/%3e%3cpath fill='%23ffffff' d='M0 0 H1440 V65 C1280 40 1120 93 940 72 C780 52 655 44 465 66 C290 86 150 38 0 65 Z'/%3e%3c/svg%3e") center -1px / 100% clamp(36px, 4.5vw, 70px) no-repeat,
        radial-gradient(circle at 85% 0%, rgba(196, 160, 250, .45), transparent 45%),
        linear-gradient(120deg, rgba(42, 11, 85, .92) 0%, rgba(79, 15, 148, .84) 50%, rgba(109, 25, 190, .7) 100%);
    content: "";
}

.about-page .about-band::after {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    z-index: 1;
    height: clamp(36px, 4.5vw, 70px);
    background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 96' preserveAspectRatio='none'%3e%3cpath fill='%23ffffff' fill-opacity='.18' d='M0 25 C175 4 275 72 470 48 C670 22 775 18 945 49 C1120 80 1280 16 1440 38 L1440 96 L0 96 Z'/%3e%3cpath fill='%23ffffff' d='M0 65 C150 38 290 86 465 66 C655 44 780 52 940 72 C1120 93 1280 40 1440 65 L1440 96 L0 96 Z'/%3e%3c/svg%3e") center bottom / 100% 100% no-repeat;
    content: "";
}

.about-page .about-band .container { position: relative; z-index: 2; }

/* Logo sits directly on the purple (no white box). A soft light glow keeps
   the dark-blue letters readable against the dark background. */
.about-page .about-band img {
    filter:
        drop-shadow(0 0 1px rgba(255, 255, 255, .9))
        drop-shadow(0 0 10px rgba(255, 255, 255, .35));
}

.about-page .about-band h1 {
    margin-top: 1rem;
    color: #fff;
    font-size: clamp(1.8rem, 3.6vw, 2.6rem);
    font-weight: 700 !important;
    text-shadow: 0 2px 18px rgba(20, 6, 45, .35);
}

/* ---- Timeline ---- */
.about-page .about-timeline .timeline::before {
    width: 3px;
    margin-left: -1.5px;
    background: linear-gradient(180deg, var(--ssm-primary), #c4a0fa 70%, transparent);
    border-radius: 3px;
}

.about-page .about-timeline li > .timeline-badge {
    width: 22px;
    height: 22px;
    margin-left: -11px;
    background: #fff;
    border: 5px solid var(--ssm-primary);
    box-shadow: 0 0 0 6px var(--ssm-soft);
}

.about-page .about-timeline li > .timeline-badge::before { display: none; }

.about-page .about-timeline li > .timeline-badge p {
    width: auto;
    margin-top: -6px;
    margin-left: 26px;
    padding: .15rem .8rem;
    color: var(--ssm-primary) !important;
    background: var(--ssm-soft);
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
    white-space: nowrap;
}

.about-page .about-timeline li.inverted > .timeline-badge p {
    margin-right: 26px;
    margin-left: 0;
}

.about-page .about-timeline li > .timeline-card {
    padding: 1.25rem 1.5rem;
    text-align: left;
    background: #fff;
    border: 1px solid var(--ssm-border);
    border-radius: var(--site-radius);
    box-shadow: var(--site-shadow);
    transition: transform .2s ease, box-shadow .2s ease;
}

.about-page .about-timeline li > .timeline-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--site-shadow-hover);
}

.about-page .about-timeline .timeline-card h5 {
    margin-bottom: .5rem;
    color: var(--ssm-primary);
    font-size: 1.15rem;
    font-weight: 700;
}

.about-page .about-timeline .timeline-card p {
    margin: 0;
    color: var(--ssm-muted) !important;
    line-height: 1.8;
}

.about-page .about-timeline .timeline-arrow { color: #c4a0fa; }

/* style.css shifts the arrow with left:32px on a 100%-wide item, which made the
   page 2px wider than the phone. Use padding instead of an offset. */
@media (max-width: 768px) {
    .about-page .about-timeline .timeline-arrow {
        left: 0 !important;
        padding-left: 32px;
        box-sizing: border-box;
    }
}

@media (max-width: 768px) {
    .about-page .about-timeline li > .timeline-card { padding: 1rem 1.1rem; }

    .about-page .about-timeline li > .timeline-badge p,
    .about-page .about-timeline li.inverted > .timeline-badge p {
        margin-right: 0;
        margin-left: 26px !important;
        float: none;
    }
}

/* ==========================================================================
   About detail (about-detail.php) — body.article-page
   Article HTML comes from the database; only its presentation is styled.
   ========================================================================== */

.article-page .blog-content {
    position: relative;
    z-index: 2;
    margin-top: -2.5rem;
    margin-bottom: 3rem;
    padding: 3rem clamp(1.25rem, 6vw, 5rem);
    background: #fff;
}

/* Readable column */
.article-page #db-detail {
    max-width: 860px;
    margin: 0 auto;
    color: var(--ssm-muted);
    font-size: 1.05rem;
    line-height: 1.9;
}

.article-page #db-detail p { margin-bottom: 1.1rem; }

.article-page #db-detail strong,
.article-page #db-detail b { color: var(--ssm-dark); }

/* Headings: purple with the same accent bar as about.php */
.article-page #db-detail h1,
.article-page #db-detail h2,
.article-page #db-detail h3,
.article-page #db-detail h4 {
    position: relative;
    margin: 2.25rem 0 1rem;
    padding-left: 1rem;
    color: var(--ssm-primary);
    font-weight: 700;
    line-height: 1.4;
}

.article-page #db-detail > :first-child { margin-top: 0; }

.article-page #db-detail h1 { font-size: clamp(1.5rem, 2.6vw, 1.9rem); }
.article-page #db-detail h2 { font-size: clamp(1.35rem, 2.3vw, 1.7rem); }
.article-page #db-detail h3 { font-size: clamp(1.2rem, 2vw, 1.45rem); }
.article-page #db-detail h4 { font-size: 1.15rem; }

.article-page #db-detail h1::before,
.article-page #db-detail h2::before,
.article-page #db-detail h3::before,
.article-page #db-detail h4::before {
    position: absolute;
    top: .25em;
    bottom: .25em;
    left: 0;
    width: 5px;
    border-radius: 5px;
    background: linear-gradient(180deg, #8b3be0, var(--ssm-accent));
    content: "";
}

.article-page #db-detail h5,
.article-page #db-detail h6 {
    color: var(--ssm-dark);
    font-weight: 600;
    line-height: 1.6;
}

/* Quotes: lavender card */
.article-page #db-detail blockquote {
    position: relative;
    margin: 1.75rem 0;
    padding: 1.25rem 1.5rem 1.25rem 3.25rem;
    background: var(--ssm-soft);
    border: 0;
    border-left: 0 !important;
    border-radius: var(--site-radius);
}

.article-page #db-detail blockquote::before {
    position: absolute;
    top: .35rem;
    left: 1rem;
    color: var(--ssm-primary);
    font-family: Georgia, serif;
    font-size: 3rem;
    line-height: 1;
    opacity: .6;
    content: "\201C";
}

.article-page #db-detail blockquote p {
    margin: 0;
    padding: 0;
    color: var(--ssm-dark);
    border-left: 0 !important;
    font-size: 1.02rem;
}

.article-page #db-detail blockquote p + p { margin-top: .75rem; }

/* Lists: purple markers, a little air between items */
.article-page #db-detail ol,
.article-page #db-detail ul {
    margin: 0 0 1.25rem;
    padding-left: 1.5rem;
}

.article-page #db-detail li { margin-bottom: .45rem; padding-left: .25rem; }
.article-page #db-detail li::marker { color: var(--ssm-primary); font-weight: 700; }

/* Media inside the article */
.article-page #db-detail img {
    max-width: 100%;
    height: auto;
    border-radius: 14px;
}

.article-page #db-detail iframe {
    max-width: 100%;
    border: 0;
    border-radius: 14px;
}

/* YouTube embeds come with width="560" height="315": scale them to the column */
.article-page #db-detail iframe[src*="youtube"] {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    margin: 1rem 0;
}

/* Links inside article text must look clickable (the site removes underlines globally) */
.article-page #db-detail a,
.media-detail-page .media-desc a {
    color: var(--ssm-primary);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}

.article-page #db-detail a:hover,
.media-detail-page .media-desc a:hover { color: var(--ssm-primary-dark); text-decoration-thickness: 2px; }

/* Media pages: images inside descriptions fit their column */
.media-detail-page .media-desc img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

.article-page #db-detail table {
    width: 100%;
    margin-bottom: 1.25rem;
    border-collapse: collapse;
}

.article-page #db-detail th,
.article-page #db-detail td {
    padding: .6rem .8rem;
    border: 1px solid var(--ssm-border);
}

.article-page #db-detail th { color: var(--ssm-dark); background: var(--ssm-soft); }

/* "แก้ไขล่าสุด" line */
.article-page .blog-content .text-end {
    max-width: 860px;
    margin: 1rem auto 0;
}

.article-page .blog-content .text-end hr { border-color: var(--ssm-border); }

.article-page .blog-content .text-end p {
    margin: .25rem 0;
    color: var(--ssm-muted) !important;
    font-size: .9rem;
}

/* Related pages carousel */
.article-page .owl-carousel { margin-top: 2rem; }

.article-page .owl-carousel .card {
    border: 1px solid var(--ssm-border) !important;
}

.article-page .owl-carousel .card-img-top { border: 0 !important; }

.article-page .owl-carousel .card-body-about {
    display: flex;
    align-items: center;
    justify-content: center;
    height: auto !important;
    min-height: 90px;
    padding: 1rem 1.1rem !important;
    background: #fff !important;
}

.article-page .owl-carousel .card-body-about .card-title {
    margin: 0;
    color: var(--ssm-dark) !important;
    font-size: 1rem;
    line-height: 1.45;
}

.article-page .owl-carousel .card:hover .card-title { color: var(--ssm-primary) !important; }

/* ---- Article extras (blog/act/news/center): tag or project row, back button, related cards ---- */
.article-page #db-detail + .col-12:not(.text-end) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    max-width: 860px;
    margin: 1.5rem auto 0;
    color: var(--ssm-muted);
    font-size: .95rem;
}

.article-page .badge-outlined {
    padding: .35em .9em;
    color: var(--ssm-primary) !important;
    background: var(--ssm-soft) !important;
    border: 0 !important;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 500;
}

/* empty tag chips (unknown tag values) */
.article-page .badge-outlined:empty { display: none; }

.article-page .blog-content .row > .mx-auto { margin-top: 1.75rem !important; }

.article-page .blog-content .btn-invite {
    padding: .6rem 1.75rem;
    border-radius: 999px;
}

.article-page .blog-content h1.border-short-bottom {
    margin-top: 2.5rem !important;
    font-size: clamp(1.5rem, 2.6vw, 2rem);
}

/* equal-height related cards so the "อ่านต่อ" buttons line up */
.article-page .owl-carousel .owl-stage { display: flex; }
.article-page .owl-carousel .owl-item { display: flex; }
.article-page .owl-carousel .owl-item > section { display: flex; }
.article-page .owl-carousel .owl-item .card { width: 100%; }
.article-page .owl-carousel .card > .p-3 { margin-top: auto; }

.article-page .owl-carousel .card-body {
    height: auto;
    min-height: 140px;
    padding: 1rem 1.1rem .5rem;
}

.article-page .owl-carousel .card-title {
    display: -webkit-box;
    overflow: hidden;
    font-size: 1rem;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.article-page .owl-carousel .card-text {
    display: -webkit-box;
    overflow: hidden;
    font-size: .88rem;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

@media (max-width: 767.98px) {
    .article-page .blog-content { margin-top: -1.5rem; padding: 2rem 1.1rem; }
    .article-page #db-detail { font-size: 1rem; }
    .article-page #db-detail blockquote { padding: 1rem 1rem 1rem 2.75rem; }
}

/* ==========================================================================
   Media detail (medias-detail.php) — body.media-detail-page
   ========================================================================== */

/* The header already says "สื่อ สสม."; the repeated heading only added a gap */
.media-detail-page .media-heading { display: none; }

.media-detail-page .media-detail {
    position: relative;
    z-index: 2;
    margin-top: -2.5rem;
    padding-top: 0 !important;
}

.media-detail-page .media-card {
    padding: 1.5rem;
    border-radius: 24px;
    box-shadow: var(--site-shadow-hover);
}

.media-detail-page .media-card:hover { transform: none; }

/* Cover */
.media-detail-page .media-card .col-md-4 {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1.25rem;
    background: var(--ssm-soft);
    border-radius: var(--site-radius);
}

.media-detail-page .media-card .col-md-4 .card-img-top {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(73, 33, 140, .22);
}

/* Info column */
.media-detail-page .media-card .card-body {
    padding: .5rem 0 0 2rem;
}

.media-detail-page .media-card .card-title {
    margin-bottom: .9rem;
    color: var(--ssm-dark) !important;
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
    font-weight: 700;
    line-height: 1.35;
}

.media-detail-page .media-meta {
    display: inline-block;
    margin-bottom: 1rem;
    padding: .35rem 1rem;
    color: var(--ssm-primary);
    background: var(--ssm-soft);
    border-radius: 999px;
    font-size: .9rem;
}

.media-detail-page .media-meta b { color: var(--ssm-dark); font-weight: 600; }

.media-detail-page .media-price {
    display: flex;
    align-items: baseline;
    gap: .4rem;
    width: fit-content;
    margin-bottom: 1.5rem;
    padding: .6rem 1.1rem;
    color: var(--ssm-muted);
    background: #fff7ea;
    border: 1px solid #ffe2b3;
    border-radius: 14px;
}

.media-detail-page .media-price .h4 {
    margin: 0;
    color: #c26d00 !important;
    font-size: 1.6rem;
    font-weight: 700;
}

.media-detail-page .media-desc {
    margin-bottom: 1.5rem;
    padding-top: 1.25rem;
    color: var(--ssm-muted);
    border-top: 1px solid var(--ssm-border);
    line-height: 1.9;
}

.media-detail-page .media-desc b,
.media-detail-page .media-desc strong { color: var(--ssm-dark); }

/* Actions row: contact + download + stock count */
.media-detail-page .media-contact,
.media-detail-page .media-card .btn-success {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin: 0 .5rem .5rem 0;
    padding: .6rem 1.5rem;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
}

.media-detail-page .media-contact {
    color: var(--ssm-primary);
    border: 2px solid var(--ssm-primary);
    text-decoration: none;
}

.media-detail-page .media-contact:hover { color: #fff; background: var(--ssm-primary); }

.media-detail-page .media-contact h6 {
    margin: 0;
    color: inherit;
    font-size: 1rem;
    font-weight: 600;
}

.media-detail-page .media-card .btn-success { padding: .7rem 1.75rem; }

.media-detail-page .media-card .btn-success:disabled { opacity: .45; }

.media-detail-page .media-count {
    display: inline-block;
    margin-bottom: .5rem;
    padding: .3rem .85rem;
    color: var(--ssm-muted);
    background: var(--ssm-soft);
    border-radius: 999px;
    font-size: .9rem;
    vertical-align: middle;
}

.media-detail-page .media-count .text-danger { color: var(--ssm-primary) !important; font-weight: 700; }

.media-detail-page .media-card .card-body > hr { display: none; }

@media (max-width: 767.98px) {
    .media-detail-page .media-detail { margin-top: -1.5rem; }
    .media-detail-page .media-card { padding: 1rem; }
    .media-detail-page .media-card .card-body { padding: 1.25rem 0 0; }
}
