/* ═══════════════════════════════════════════════════════════════════════
   css/tb1-royal-award.css — หน้าสถานศึกษารางวัลพระราชทาน (royal_award.php) · 5 ต.ค. 2569
   ต่อจากธีมกลาง css/tb1-info-page.css (ส่วนหัว การ์ดตัวเลข เมนูหัวข้อ การ์ด ปุ่ม สีหมึก ใช้ของไฟล์นั้น)
   ไฟล์นี้มีเฉพาะ: ส่วนหัวแบบมีภาพ เส้นทางสู่รางวัล 5 ด้าน อัลบั้มภาพ ก้าวต่อไป และตัวดูภาพขยาย (คลาส ra-)
   สีทองใช้เป็นสีเน้น (ขอบ จุด ไอคอน) ตัวอักษรใช้สีหมึกของธีมเสมอ
   มือถือก่อน · โหมดมืด · ความคมชัดสูง · พิมพ์
   ═══════════════════════════════════════════════════════════════════════ */

.ra {
    --ra-gold: #D97706;
    --ra-gold-2: #FBBF24;
    --ra-gold-soft: color-mix(in srgb, #F59E0B 14%, var(--ip-card));
}

[data-theme="dark"] .ra,
html.dark-mode .ra {
    --ra-gold: #FBBF24;
    --ra-gold-soft: color-mix(in srgb, #F59E0B 16%, var(--ip-card));
}

/* ── ส่วนหัว: ข้อความ | ภาพ ─────────────────────────────────────────────── */
.ra-hero {
    border-bottom: 4px solid var(--ra-gold-2);
}

/* มงกุฎจาง ๆ มุมขวาบน เป็นลายน้ำ ไม่ใช่ภาพที่ต้องอ่าน */
.ra-crown {
    position: absolute;
    right: -1.5rem;
    top: -2.5rem;
    font-size: 15rem;
    line-height: 1;
    color: rgba(255, 255, 255, .05);
}

.ra-hero-in {
    display: grid;
    gap: 1.75rem;
    align-items: center;
}

.ra-hero-text {
    min-width: 0;
}

.ra-eyebrow {
    color: #FDE68A;
    border-color: rgba(253, 230, 138, .45);
}

.ra-hero h1 {
    margin-top: .8rem;
}

.ra-gold {
    color: #FDE68A;
}

.ra-hero-acts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .6rem;
    margin-top: 1.25rem !important;
}

.ip .ra-btn-gold {
    color: #3B2300;
    background: #FBBF24;
    border-color: #FBBF24;
    font-weight: 700;
}

.ip .ra-btn-gold:hover {
    background: #FCD34D;
    border-color: #FCD34D;
}

.ip .ra-btn-glass {
    color: #fff;
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .45);
}

.ip .ra-btn-glass:hover {
    background: rgba(255, 255, 255, .18);
    border-color: #fff;
}

.ra-hero-photo {
    position: relative;
    justify-self: center;
    width: min(100%, 22rem);
    margin: 0;
    padding: 6px;
    border-radius: var(--tb1-radius-lg, 22px);
    background: linear-gradient(145deg, #FDE68A, #D97706 55%, #FBBF24);
    box-shadow: 0 24px 50px -22px rgba(2, 6, 23, .85);
}

.ra-hero-photo picture,
.ra-hero-photo img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: 17px;
}

.ra-hero-photo figcaption {
    position: absolute;
    left: 16px;
    bottom: 16px;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    max-width: calc(100% - 32px);
    padding: .25rem .7rem;
    border-radius: 999px;
    background: rgba(8, 17, 40, .78);
    color: #fff;
    font-size: var(--tb1-fs-xs, .875rem);
    font-weight: 600;
}

/* จอแคบ: ภาพเป็นแนวนอน ไม่ดันการ์ดตัวเลขลงไปไกล (ภาพเดิมเป็นแนวตั้ง ครอบให้คนทั้งสี่อยู่กลาง) */
@media (max-width: 899.98px) {
    .ra-hero-photo {
        width: min(100%, 28rem);
    }

    .ra-hero-photo picture,
    .ra-hero-photo img {
        aspect-ratio: 4 / 3;
        object-position: 50% 62%;
    }
}

@media (min-width: 900px) {
    .ra-hero-in {
        grid-template-columns: minmax(0, 1.35fr) minmax(16rem, 1fr);
        gap: clamp(2rem, 4vw, 3.5rem);
        text-align: left;
    }

    .ra-hero .ip-lead {
        margin: 0 !important;
    }

    .ra-hero-meta,
    .ra-hero-acts {
        justify-content: flex-start;
    }

    .ra-hero-photo {
        justify-self: end;
        width: min(100%, 24rem);
        transform: rotate(1.2deg);
    }
}

/* การ์ดตัวเลขที่เป็นข้อความ (ประเภทรางวัล): ตัวเล็กลงให้พอดีการ์ด */
.ra-kpi-text {
    font-size: clamp(1.1rem, 3.6vw, 1.45rem) !important;
}

.ra-kpi-text small {
    display: block;
    margin-left: 0 !important;
    margin-top: .1rem;
    font-size: .95rem !important;
    font-weight: 600 !important;
    color: var(--ip-ink2) !important;
}

/* ── เส้นทางสู่รางวัล ──────────────────────────────────────────────────── */
.ra-steps {
    position: relative;
    display: grid;
    gap: 1.1rem;
    padding-left: 2.6rem !important;
}

/* เส้นเวลา: แนวตั้งทางซ้ายบนจอแคบ แนวนอนด้านบนบนจอกว้าง */
.ra-steps::before {
    content: '';
    position: absolute;
    left: 1.05rem;
    top: .6rem;
    bottom: .6rem;
    width: 3px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--ra-gold-2), var(--ra-gold));
}

.ra-step {
    position: relative;
    min-width: 0;
}

.ra-step-dot {
    position: absolute;
    left: -2.6rem;
    top: .55rem;
    z-index: 1;
    width: 2.2rem;
    height: 2.2rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--ra-gold-2);
    color: #3B2300;
    font-size: var(--tb1-fs-xs, .875rem);
    box-shadow: 0 0 0 4px var(--ip-page);
}

.ra-step-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border-radius: var(--ip-r);
    background: var(--ip-card);
    border: 1px solid var(--ip-line);
    box-shadow: var(--ip-sh);
}

.ra-step-media img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.ra-step-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: .45rem;
    padding: 1rem 1.1rem 1.1rem;
}

.ra-step-when {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .6rem;
    font-size: var(--tb1-fs-xs, .875rem);
    font-weight: 700;
    color: var(--ip-ink2);
}

.ra-step-n {
    padding: .05rem .6rem;
    border-radius: 999px;
    background: var(--ra-gold-soft);
    border: 1px solid color-mix(in srgb, #F59E0B 45%, var(--ip-line));
    color: var(--ip-ink1);
    font-size: var(--tb1-fs-xs, .875rem);
}

.ra-step h3 {
    font-family: var(--ip-fd);
    font-size: var(--tb1-fs-lg, 1.25rem);
    font-weight: 800;
    line-height: 1.4;
    color: var(--tb1-heading, var(--ip-ink1));
}

.ra-step-text {
    color: var(--ip-ink2);
    font-size: var(--tb1-fs-sm, 1rem);
}

.ip .ra-step-link {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 32px;
    margin-top: auto;
    padding-top: .25rem;
}

/* แท็บเล็ต: ภาพซ้าย ข้อความขวา การ์ดไม่สูงเกินจอ */
@media (min-width: 600px) and (max-width: 899.98px) {
    .ra-step-card {
        flex-direction: row;
    }

    .ra-step-media {
        flex: 0 0 42%;
    }

    .ra-step-media picture,
    .ra-step-media img {
        height: 100%;
        aspect-ratio: auto;
        min-height: 12rem;
    }
}

@media (min-width: 900px) {
    .ra-steps {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1.25rem;
        padding: 3rem 0 0 !important;
    }

    .ra-steps::before {
        left: 16.6%;
        right: 16.6%;
        top: 1.05rem;
        bottom: auto;
        width: auto;
        height: 3px;
        background: linear-gradient(90deg, var(--ra-gold-2), var(--ra-gold));
    }

    .ra-step-dot {
        left: 50%;
        top: -3rem;
        transform: translateX(-50%);
    }
}

/* ── 5 ด้าน ──────────────────────────────────────────────────────────── */
.ra-pillars {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 700px) {
    .ra-pillars {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* จอกว้าง: 3 + 2 ใบ ใบในแถวล่างกว้างขึ้นให้เต็มแถว */
@media (min-width: 1100px) {
    .ra-pillars {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .ra-pillars > li {
        grid-column: span 2;
    }

    .ra-pillars > li:nth-child(4),
    .ra-pillars > li:nth-child(5) {
        grid-column: span 3;
    }
}

.ra-pillar {
    display: flex;
    flex-direction: column;
    border-top: 4px solid var(--ra-gold-2);
}

.ra-pillar-n {
    font-size: var(--tb1-fs-xs, .875rem);
    font-weight: 700;
    color: var(--ip-ink3);
    letter-spacing: .02em;
}

.ra-proof {
    display: grid;
    gap: .35rem;
    margin-top: .8rem !important;
    padding-top: .75rem !important;
    border-top: 1px dashed var(--ip-line2);
}

.ra-proof li {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    font-size: var(--tb1-fs-sm, 1rem);
    color: var(--ip-ink1);
    line-height: 1.5;
}

.ra-proof li > i {
    flex: none;
    margin-top: .25rem;
    color: var(--ip-green);
}

.ip .ra-proof a {
    display: inline-flex;
    align-items: flex-start;
    gap: .5rem;
    min-height: 28px;
}

.ip .ra-proof a > i {
    flex: none;
    margin-top: .3rem;
    font-size: .78rem;
}

.ra-pillar-note {
    margin-top: auto !important;
    padding-top: .6rem;
    font-size: var(--tb1-fs-xs, .875rem);
    color: var(--ip-ink3);
}

/* ── อัลบั้มภาพ ────────────────────────────────────────────────────────── */
.ra-album + .ra-album {
    margin-top: 1.75rem;
}

.ra-album-h {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-bottom: .8rem !important;
    font-family: var(--ip-fd);
    font-size: var(--tb1-fs-md, 1.125rem);
    font-weight: 700;
    color: var(--tb1-heading, var(--ip-ink1));
}

.ra-album-h i {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    flex: none;
    border-radius: 10px;
    background: var(--ra-gold-soft);
    color: var(--ra-gold);
    font-size: .85rem;
}

.ra-shots {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
}

@media (min-width: 760px) {
    .ra-shots {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: .9rem;
    }
}

.ra-shot {
    margin: 0;
    min-width: 0;
}

.ip a.ra-shot-link {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: var(--tb1-radius-md, 16px);
    border: 1px solid var(--ip-line);
    background: var(--ip-alt);
    box-shadow: var(--ip-sh);
}

.ra-shot-link img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.ra-shot-zoom {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(8, 17, 40, .7);
    color: #fff;
    font-size: var(--tb1-fs-xs, .875rem);
}

.ra-shot figcaption {
    margin-top: .35rem;
    font-size: var(--tb1-fs-xs, .875rem);
    line-height: 1.45;
    color: var(--ip-ink2);
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    .ra-shot-link img {
        transition: transform .6s var(--ip-ease);
    }

    .ip a.ra-shot-link:hover img {
        transform: scale(1.05);
    }
}

/* ── ก้าวต่อไป ──────────────────────────────────────────────────────────── */
.ra-next-in {
    position: relative;
    overflow: hidden;
    padding: clamp(1.5rem, 1rem + 2vw, 2.5rem) clamp(1.1rem, .8rem + 2vw, 2.5rem);
    border-radius: var(--ip-r);
    text-align: center;
    color: #fff;
    background:
        radial-gradient(90% 120% at 0% 0%, #2563EB 0%, transparent 60%),
        linear-gradient(135deg, #172554 0%, #1E3A8A 55%, #1D4ED8 100%);
    border-top: 4px solid var(--ra-gold-2);
}

[data-theme="dark"] .ra-next-in,
html.dark-mode .ra-next-in {
    background:
        radial-gradient(90% 120% at 0% 0%, rgba(37, 99, 235, .45) 0%, transparent 60%),
        linear-gradient(135deg, #060D1A 0%, #0B1A33 55%, #0F2447 100%);
}

.ra-next-ic {
    width: 52px;
    height: 52px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: #FBBF24;
    color: #3B2300;
    font-size: 1.2rem;
}

.ra-next-in h2 {
    margin-top: .7rem !important;
    font-family: var(--ip-fd);
    font-size: var(--tb1-fs-2xl, clamp(1.5rem, 1.2rem + 1vw, 1.875rem));
    font-weight: 800;
    color: #fff;
}

.ra-next-in > p {
    max-width: 46rem;
    margin: .5rem auto 0 !important;
    color: rgba(255, 255, 255, .92);
}

.ra-next-quote {
    max-width: 40rem;
    margin: 1.1rem auto 0 !important;
    padding: .85rem 1.1rem;
    border-left: 4px solid #FBBF24;
    border-radius: 0 12px 12px 0;
    background: rgba(255, 255, 255, .1);
    color: #FDE68A;
    font-weight: 600;
    text-align: left;
}

/* ── ตัวดูภาพขยาย ────────────────────────────────────────────────────── */
/* เต็มจอด้วย inset ไม่ใช้ 100vw/100vh: fonts/tb1-size.css ย่อทั้งหน้าด้วย zoom ซึ่งทำให้ 100vw เหลือ 90% ของจอ */
.ra-viewer {
    position: fixed;
    inset: 0;
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(3, 7, 18, .94);
    color: #fff;
}

.ra-viewer:not([open]) {
    display: none;
}

.ra-viewer::backdrop {
    background: rgba(3, 7, 18, .7);
}

.ra-viewer-fig {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    height: 100%;
    margin: 0;
    padding: 3.75rem 3.75rem 1.5rem;
}

.ra-viewer-fig img {
    display: block;
    max-width: 100%;
    max-height: calc(100% - 3rem);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

.ra-viewer-fig figcaption {
    max-width: 48rem;
    text-align: center;
    font-size: var(--tb1-fs-sm, 1rem);
    color: #fff;
}

.ra-viewer-count {
    margin-left: .4rem;
    color: #CBD5E1;
    font-size: var(--tb1-fs-xs, .875rem);
    white-space: nowrap;
}

.ra-viewer-btn {
    position: absolute;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 50%;
    background: rgba(15, 23, 42, .75);
    color: #fff;
    font-size: var(--tb1-fs-md, 1.125rem);
    cursor: pointer;
}

.ra-viewer-btn:hover {
    background: rgba(30, 41, 59, .95);
    border-color: #fff;
}

.ra-viewer-btn:focus-visible {
    outline: 3px solid #F59E0B;
    outline-offset: 2px;
}

.ra-viewer-btn.is-close {
    right: 12px;
    top: 12px;
}

.ra-viewer-btn.is-prev,
.ra-viewer-btn.is-next {
    top: 50%;
    transform: translateY(-50%);
}

.ra-viewer-btn.is-prev {
    left: 8px;
}

.ra-viewer-btn.is-next {
    right: 8px;
}

@media (max-width: 640px) {
    .ra-viewer-fig {
        padding: 3.5rem .5rem 5rem;
    }

    .ra-viewer-btn.is-prev,
    .ra-viewer-btn.is-next {
        top: auto;
        bottom: 14px;
        transform: none;
    }

    .ra-viewer-btn.is-prev {
        left: calc(50% - 56px);
    }

    .ra-viewer-btn.is-next {
        right: calc(50% - 56px);
    }

    .ra-crown {
        font-size: 10rem;
    }
}

/* ── ความคมชัดสูง ──────────────────────────────────────────────────────── */
html.tb1-contrast-high .ra-hero {
    border-bottom-color: #facc15;
}

html.tb1-contrast-high .ra-crown,
html.tb1-contrast-high .ra-steps::before {
    display: none;
}

html.tb1-contrast-high .ra :is(.ra-step-card, .ra-step-n, .ra-pillar, .ra-next-in, .ra-next-quote, .ra-album-h i, .ra-hero-photo figcaption, .ra-shot-zoom) {
    background: #000 !important;
    border: 2px solid #fff;
    box-shadow: none !important;
}

html.tb1-contrast-high .ra .ra-hero-photo {
    padding: 0;
    background: none;
    border: 2px solid #fff;
    box-shadow: none;
    transform: none;
}

html.tb1-contrast-high .ra :is(.ra-step-dot, .ra-next-ic) {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #facc15;
    box-shadow: none;
}

html.tb1-contrast-high .ra a.ra-shot-link {
    border: 2px solid #facc15 !important;
    box-shadow: none !important;
}

/* ปุ่มหลัก: ดำบนเหลือง (ต้องหนักกว่ากฎ .ip :is(... .ip-btn ...) ของธีมกลางที่ทาพื้นดำทุกปุ่ม) */
html.tb1-contrast-high .ra a.ip-btn.ra-btn-gold,
html.tb1-contrast-high .ra a.ip-btn.ra-btn-gold * {
    color: #000 !important;
}

html.tb1-contrast-high .ra a.ip-btn.ra-btn-gold {
    background: #facc15 !important;
    border: 2px solid #facc15 !important;
}

html.tb1-contrast-high .ra a.ip-btn.ra-btn-glass {
    background: #000 !important;
    border: 2px solid #facc15 !important;
}

html.tb1-contrast-high .ra .ra-proof li > i {
    color: #fff;
}

/* ── พิมพ์ ─────────────────────────────────────────────────────────────── */
@media print {
    .ra-hero-acts,
    .ra-crown,
    .ra-shot-zoom,
    .ra-viewer,
    .ra-step-dot,
    .ra-steps::before {
        display: none !important;
    }

    .ra-hero {
        border-bottom: 2px solid #000;
    }

    .ra-gold,
    .ra-eyebrow {
        color: #000 !important;
    }

    .ra-hero-in {
        grid-template-columns: minmax(0, 1fr) 9rem;
        text-align: left;
    }

    .ra-hero-photo {
        padding: 0;
        background: none;
        box-shadow: none;
        transform: none;
    }

    .ra-hero-photo figcaption {
        display: none;
    }

    .ra-steps {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        padding: 0 !important;
    }

    .ra-step-card,
    .ra-pillar,
    .ra-shot {
        break-inside: avoid;
        box-shadow: none;
    }

    .ra-shots {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ra-next-in {
        color: #000;
        background: none !important;
        border: 1px solid #999;
    }

    .ra-next-in h2,
    .ra-next-in > p,
    .ra-next-quote {
        color: #000 !important;
        background: none !important;
    }
}
