/* ==========================================================================
   หน้าเทิดพระเกียรติ — โรงเรียนวัดบ้านหมี่
   A standing page for a royal occasion. It carries no site chrome: no menu,
   no header, no footer navigation. Quiet and formal — generous space, a
   single accent colour, nothing that competes with the words. Prints well.
   ========================================================================== */

:root {
    --ink: #1b2742;
    --ink-soft: #55637d;
    --line: rgba(27, 39, 66, .12);
    --paper: #fffdf8;
}

.tribute {
    --accent: #a8822a;
    --accent-2: #d8b65c;
    --accent-wash: #fdf7e8;
}

.tribute--blue { --accent: #2c408a; --accent-2: #6d85d8; --accent-wash: #eef1fb; }
.tribute--yellow { --accent: #c29402; --accent-2: #ffd84d; --accent-wash: #fffbea; }
.tribute--purple { --accent: #64408f; --accent-2: #a57fd4; --accent-wash: #f6f1fc; }

*, *::before, *::after { box-sizing: border-box; }

body.tribute {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: "Sarabun", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 17px;
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.45; }
p { margin: 0; }
img { max-width: 100%; }

a { color: var(--accent); }

:focus-visible {
    outline: 3px solid var(--accent-2);
    outline-offset: 3px;
    border-radius: 6px;
}

.tribute__ribbon {
    height: 7px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2) 30%, #fff3cf 50%, var(--accent-2) 70%, var(--accent));
}

/* Back to the site — the only navigation on the page. */
.tribute__back {
    position: absolute;
    top: 24px;
    left: clamp(16px, 4vw, 44px);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .8);
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: color .18s ease, border-color .18s ease;
}

.tribute__back:hover { color: var(--accent); border-color: var(--accent-2); }

/* Head ------------------------------------------------------------------- */

.tribute__head {
    position: relative;
    padding: clamp(64px, 9vw, 120px) clamp(18px, 5vw, 48px) clamp(34px, 4.5vw, 60px);
    background:
        radial-gradient(900px 420px at 50% -10%, var(--accent-wash), transparent 70%),
        linear-gradient(180deg, var(--accent-wash), var(--paper));
    text-align: center;
}

/* พระปรมาภิไธยย่อ ภปร — the emblem of the occasion. */
.tribute__cypher {
    display: block;
    width: auto;
    height: clamp(130px, 15vw, 190px);
    margin: 0 auto clamp(20px, 2.6vw, 30px);
    filter: drop-shadow(0 12px 26px rgba(27, 39, 66, .2));
}

.tribute__occasion {
    margin-bottom: 14px;
    color: var(--accent);
    font-size: clamp(22px, 2.9vw, 38px);
    font-weight: 700;
    letter-spacing: .06em;
}

.tribute__title {
    max-width: 22ch;
    margin: 0 auto;
    font-size: clamp(24px, 3.3vw, 42px);
    line-height: 1.5;
}

.tribute__subtitle {
    max-width: 50ch;
    margin: clamp(14px, 1.8vw, 22px) auto 0;
    color: var(--ink-soft);
    font-size: clamp(15px, 1.25vw, 18px);
}

/* A small ornamental rule, in place of a decorative image. */
.tribute__flourish {
    display: block;
    width: 120px;
    height: 20px;
    margin: clamp(22px, 3vw, 34px) auto 0;
    background:
        linear-gradient(90deg, transparent, var(--accent) 50%, transparent) center / 100% 1px no-repeat,
        radial-gradient(circle, var(--accent) 3.5px, transparent 4px) center / 20px 20px no-repeat;
}

/* Main ------------------------------------------------------------------- */

.tribute__main {
    width: min(100%, 1040px);
    margin: 0 auto;
    padding: 0 clamp(18px, 5vw, 48px);
}

.tribute__portrait {
    max-width: min(100%, 420px);
    margin: clamp(30px, 4vw, 54px) auto 0;
}

.tribute__portrait img {
    display: block;
    width: 100%;
    height: auto;
    padding: 10px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 30px 70px -40px rgba(27, 39, 66, .8), 0 0 0 1px var(--line);
}

.tribute__section-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(12px, 2vw, 22px);
    margin-bottom: clamp(22px, 2.8vw, 36px);
    color: var(--accent);
    font-size: clamp(19px, 2vw, 26px);
    text-align: center;
}

.tribute__section-title::before,
.tribute__section-title::after {
    flex: 1;
    max-width: 110px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-2));
    content: "";
}

.tribute__section-title::after { background: linear-gradient(90deg, var(--accent-2), transparent); }

/* The words of remembrance */

.tribute__words { margin-top: clamp(44px, 6vw, 84px); }

.tribute__text {
    max-width: 42em;
    margin: 0 auto;
    text-align: center;
}

.tribute__text p {
    margin-bottom: clamp(16px, 1.8vw, 26px);
    font-size: clamp(17px, 1.4vw, 21px);
    line-height: 2.15;
}

.tribute__text p:last-child { margin-bottom: 0; }

.tribute__signature {
    max-width: 42em;
    margin: clamp(26px, 3.2vw, 40px) auto 0;
    color: var(--accent);
    font-size: clamp(16px, 1.35vw, 19px);
    font-weight: 700;
    line-height: 1.95;
    text-align: center;
}

/* Royal duties */

.tribute__duties { margin-top: clamp(52px, 7vw, 96px); }

.tribute__duties-intro {
    max-width: 46em;
    margin: 0 auto clamp(26px, 3.4vw, 42px);
    color: var(--ink-soft);
    font-size: clamp(15.5px, 1.3vw, 18px);
    line-height: 2;
    text-align: center;
}

.tribute__duty-grid {
    display: grid;
    gap: clamp(16px, 2vw, 24px);
}

.tribute__duty {
    padding: clamp(22px, 2.8vw, 34px);
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 20px 48px -40px rgba(27, 39, 66, .75);
}

.tribute__duty h3 {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    color: var(--ink);
    font-size: clamp(18px, 1.7vw, 22px);
}

.tribute__duty-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(140deg, var(--accent-2), var(--accent));
    color: #fff;
    font-size: 18px;
}

.tribute__duty ul {
    display: grid;
    gap: 13px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tribute__duty li {
    position: relative;
    padding-left: 26px;
    font-size: clamp(15.5px, 1.25vw, 17px);
    line-height: 1.95;
}

.tribute__duty li::before {
    position: absolute;
    top: .72em;
    left: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-2);
    content: "";
}

/* Photographs */

.tribute__gallery-wrap { margin-top: clamp(52px, 7vw, 96px); }

.tribute__gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: clamp(14px, 1.8vw, 22px);
    margin: 0;
    padding: 0;
    list-style: none;
}

.tribute__gallery a {
    display: block;
    overflow: hidden;
    border-radius: 16px;
    background: #f1f0ec;
    box-shadow: 0 18px 40px -34px rgba(27, 39, 66, .9);
}

.tribute__gallery img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform .55s cubic-bezier(.22, 1, .36, 1);
}

.tribute__gallery a:hover img { transform: scale(1.04); }

.tribute__gallery p {
    margin-top: 10px;
    color: var(--ink-soft);
    font-size: 14.5px;
    line-height: 1.7;
    text-align: center;
}

/* Sources — printed in full, never hidden behind a link. */

.tribute__sources {
    margin-top: clamp(52px, 7vw, 96px);
    padding: clamp(22px, 3vw, 34px);
    border: 1px dashed var(--line);
    border-radius: 20px;
    background: var(--accent-wash);
}

.tribute__sources h2 {
    margin-bottom: 12px;
    color: var(--accent);
    font-size: clamp(17px, 1.5vw, 20px);
}

.tribute__sources-note {
    color: var(--ink-soft);
    font-size: 14.5px;
    line-height: 1.9;
}

.tribute__sources ol {
    display: grid;
    gap: 14px;
    margin: 18px 0;
    padding-left: 22px;
}

.tribute__sources li { font-size: 15px; line-height: 1.8; }
.tribute__sources li a { font-weight: 600; }

.tribute__sources li span {
    display: block;
    color: var(--ink-soft);
    font-size: 14px;
}

.tribute__sources li code {
    display: block;
    margin-top: 2px;
    color: var(--ink-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12.5px;
    overflow-wrap: anywhere;
}

/* Foot ------------------------------------------------------------------- */

.tribute__foot {
    margin-top: clamp(54px, 7vw, 100px);
    padding: clamp(30px, 4vw, 52px) clamp(18px, 5vw, 48px) clamp(44px, 5vw, 70px);
    border-top: 1px solid var(--line);
    background: linear-gradient(180deg, var(--paper), var(--accent-wash));
    color: var(--ink-soft);
    font-size: 15px;
    text-align: center;
}

.tribute__foot-school { color: var(--ink); font-size: 18px; font-weight: 700; }

.tribute__home {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 30px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    transition: filter .18s ease;
}

.tribute__home:hover { filter: brightness(1.1); }

@media (min-width: 860px) {
    .tribute__duty-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tribute__duty-grid > :first-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
    .tribute__gallery img { transition: none; }
}

@media print {
    .tribute__back,
    .tribute__home,
    .tribute__ribbon { display: none !important; }

    body.tribute { background: #fff; font-size: 12pt; }
    .tribute__head { padding-top: 0; background: none; }
    .tribute__duty { break-inside: avoid; box-shadow: none; }
    .tribute__gallery { grid-template-columns: repeat(3, 1fr); }
    .tribute__sources { background: none; }
}

.tribute__caption { font-weight: 600; color: var(--ink); }

.tribute__credit {
    margin-top: 4px;
    color: var(--ink-soft);
    font-size: 12.5px;
    line-height: 1.6;
    text-align: center;
}

.tribute__credit a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); }
.tribute__credit a:hover { color: var(--accent); }
