/* =========================================================
   Person module — ใช้ร่วมกับ _personCard.cshtml
   เปลี่ยนสีหลักได้ที่ --tp-accent (หรือ override ใน class personals-xxx)
   ========================================================= */
.tp-module {
    --tp-accent: #1747c9;
    --tp-accent-soft: #e8eefc;
    --tp-text: #1f2937;
    --tp-muted: #6b7280;
    --tp-line: #e5e7eb;
    --tp-card: #ffffff;
    --tp-radius: 14px;
    --tp-photo: 140px;

    color: var(--tp-text);
    padding: 2rem 0;
}

.tp-title {
    text-align: center;
    font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem);
    font-weight: 700;
    margin: 0 0 2rem;
}
.tp-title::after {
    content: "";
    display: block;
    width: 56px;
    height: 3px;
    margin: .6rem auto 0;
    border-radius: 3px;
    background: var(--tp-accent);
}

/* ---------- การ์ดพื้นฐาน ---------- */
.tp-card {
    background: var(--tp-card);
    border-radius: var(--tp-radius);
    text-align: center;
    padding: 1.25rem 1rem;
    transition: transform .2s ease, box-shadow .2s ease;
}
.tp-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(17, 24, 39, .08);
}

.tp-photo {
    width: var(--tp-photo);
    aspect-ratio: 3 / 4;              /* รูปทุกใบสัดส่วนเท่ากัน ไม่ว่าต้นฉบับขนาดไหน */
    margin: 0 auto .9rem;
    border-radius: 12px;
    overflow: hidden;
    background: var(--tp-accent-soft);
    display: grid;
    place-items: center;
}
.tp-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;      /* ไม่ตัดหัวคน */
}
.tp-initials {
    font-size: calc(var(--tp-photo) * .28);
    font-weight: 700;
    color: var(--tp-accent);
}

.tp-name {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 .25rem;
}
.tp-position {
    font-size: .875rem;
    color: var(--tp-accent);
    font-weight: 600;
    margin: 0 0 .2rem;
}
.tp-department,
.tp-contact {
    font-size: .8rem;
    color: var(--tp-muted);
    margin: 0 0 .2rem;
}
.tp-contact a { color: inherit; text-decoration: none; border-bottom: 1px dotted currentColor; }
.tp-contact a:hover { color: var(--tp-accent); }
.tp-content {
    font-size: .8rem;
    color: var(--tp-muted);
    margin-top: .5rem;
}
.tp-content > :last-child { margin-bottom: 0; }

/* ---------- ผังองค์กร (_personal, _personalOrg-2) ---------- */
.tp-org .tp-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25rem;
    position: relative;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}
/* เส้นเชื่อมระหว่างชั้น */
.tp-org .tp-row + .tp-row::before {
    content: "";
    position: absolute;
    top: -1.5rem;
    left: 50%;
    width: 2px;
    height: 1.5rem;
    background: var(--tp-line);
}
.tp-org .tp-card { width: 200px; }
/* ชั้นบนสุด (ผู้บริหารสูงสุด) เด่นกว่า */
.tp-org .tp-row:first-of-type .tp-card {
    --tp-photo: 170px;
    width: 240px;
    box-shadow: 0 0 0 2px var(--tp-accent-soft);
}
.tp-org .tp-row:first-of-type .tp-name { font-size: 1.1rem; }

/* ---------- กริด (_personalOrg-1) ---------- */
.tp-grid .tp-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 1.25rem;
}
.tp-grid .tp-card { border: 1px solid var(--tp-line); }

/* ---------- รายการแนวนอน (_personal_grid) ---------- */
.tp-list .tp-stack { display: grid; gap: 1rem; }
.tp-list .tp-card {
    display: grid;
    grid-template-columns: var(--tp-photo) 1fr;
    gap: 1.5rem;
    text-align: left;
    border: 1px solid var(--tp-line);
    padding: 1.25rem;
}
.tp-list .tp-photo { margin: 0; }
.tp-list .tp-name { font-size: 1.2rem; }
.tp-list .tp-content { font-size: .9rem; color: var(--tp-text); }

/* ---------- ไทม์ไลน์ (_personal_timeline) ---------- */
.tp-timeline .tp-line {
    list-style: none;
    margin: 0 auto;
    padding: 0 0 0 1.5rem;
    max-width: 760px;
    border-left: 2px solid var(--tp-line);
}
.tp-timeline .tp-line-item { position: relative; margin-bottom: 1.25rem; }
.tp-timeline .tp-line-item::before {
    content: "";
    position: absolute;
    left: calc(-1.5rem - 7px);
    top: 1.6rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--tp-accent);
    box-shadow: 0 0 0 4px var(--tp-accent-soft);
}
.tp-timeline .tp-card {
    --tp-photo: 72px;
    display: grid;
    grid-template-columns: var(--tp-photo) 1fr;
    gap: 1rem;
    align-items: center;
    text-align: left;
    border: 1px solid var(--tp-line);
    padding: 1rem;
}
.tp-timeline .tp-photo { margin: 0; aspect-ratio: 1; border-radius: 50%; }

/* ---------- มือถือ ---------- */
@media (max-width: 575.98px) {
    .tp-module { --tp-photo: 110px; }
    .tp-org .tp-card,
    .tp-org .tp-row:first-of-type .tp-card { width: calc(50% - .625rem); padding: 1rem .5rem; }
    .tp-org .tp-row:first-of-type .tp-card { --tp-photo: 130px; width: 100%; max-width: 260px; }
    .tp-grid .tp-cards { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
    .tp-list .tp-card { grid-template-columns: 1fr; text-align: center; }
    .tp-list .tp-photo { margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
    .tp-card { transition: none; }
    .tp-card:hover { transform: none; }
}

@media print {
    .tp-card { break-inside: avoid; box-shadow: none !important; transform: none !important; }
}
