/* =========================================================================
   Public-facing pages: directory + member profile
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #1d4ed8;
    --primary-dark: #1e40af;
    --accent: #0ea5e9;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-soft: #475569;
    --text-muted: #94a3b8;
    --radius: 14px;
    --shadow: 0 8px 28px rgba(15, 23, 42, .1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body {
    margin: 0; font-family: var(--font); color: var(--text); line-height: 1.55;
    letter-spacing: -.005em; -webkit-font-smoothing: antialiased;
    background:
        radial-gradient(800px 460px at 100% -5%, rgba(59, 130, 246, .07), transparent 60%),
        radial-gradient(700px 460px at -10% 105%, rgba(14, 165, 233, .06), transparent 55%),
        var(--bg);
    background-attachment: fixed;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.pub-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.pub-header__in { max-width: 1080px; margin: 0 auto; padding: .85rem 1.25rem; display: flex; align-items: center; gap: .75rem; }
.pub-header img { width: 38px; height: 38px; }
.pub-header b { font-size: 1.05rem; }
.pub-header span { display: block; font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .6px; }
.pub-header .spacer { flex: 1; }

.container { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

/* directory */
.dir-hero { background: linear-gradient(135deg, var(--primary-dark), var(--accent)); color: #fff; border-radius: var(--radius); padding: 2.25rem 1.75rem; margin-bottom: 1.5rem; text-align: center; }
.dir-hero h1 { color: #fff; font-size: 1.9rem; margin: 0 0 .4rem; }
.dir-hero p { color: rgba(255, 255, 255, .9); margin: 0 0 1.25rem; }
.dir-search { display: flex; gap: .6rem; max-width: 940px; margin: 0 auto; flex-wrap: wrap; align-items: stretch; }
.dir-search input, .dir-search select {
    padding: .82rem 1rem; border: none; border-radius: 12px; font-size: .95rem;
    font-family: inherit; background: #fff; color: #0f172a; height: 50px;
    box-shadow: 0 6px 16px rgba(2, 6, 23, .10);
}
.dir-search input:focus, .dir-search select:focus { outline: 2px solid rgba(255,255,255,.7); }
.dir-search input[name="q"] { flex: 1 1 100%; }          /* full-width first row */
.dir-search select { flex: 1 1 160px; min-width: 150px; cursor: pointer; }
.dir-search button {
    flex: 0 0 auto; height: 50px; padding: 0 2.2rem; border: none; border-radius: 12px;
    background: #0b1220; color: #fff; font-weight: 700; font-size: .95rem; cursor: pointer;
    box-shadow: 0 6px 16px rgba(2, 6, 23, .18); transition: background .15s, transform .05s;
}
.dir-search button:hover { background: #1e293b; }
.dir-search button:active { transform: translateY(1px); }
@media (max-width: 560px) {
    .dir-search select { flex: 1 1 46%; }
    .dir-search button { flex: 1 1 100%; }
}

.dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.1rem; }
.dir-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: transform .14s, box-shadow .14s, border-color .14s; }
.dir-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: #c7d6ee; text-decoration: none; }
.dir-card__cover { height: 76px; background-size: cover; background-position: center; }
.dir-card__body { padding: 0 1rem 1.1rem; margin-top: -36px; text-align: center; }
.dir-card__avatar { width: 72px; height: 72px; border-radius: 50%; border: 3px solid #fff; object-fit: cover; margin: 0 auto; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.1); }
.dir-card__name { font-weight: 700; margin: .55rem 0 .1rem; color: var(--text); }
.dir-card__role { color: var(--text-muted); font-size: .82rem; }
.dir-badge { display: inline-block; margin-top: .55rem; padding: .2rem .6rem; border-radius: 999px; font-size: .7rem; font-weight: 700; background: #eff6ff; color: var(--primary-dark); }

/* profile ------------------------------------------------------------------ */
.p-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.p-cover { height: 230px; background-size: cover; background-position: center; background-color: #dbe4f1; }

/* header: avatar pokes up into cover, NAME stays below on white */
.p-head { display: flex; align-items: flex-end; gap: 1.5rem; padding: 0 2rem 1.6rem; flex-wrap: wrap; }
.p-avatar { width: 150px; height: 150px; border-radius: 50%; border: 5px solid #fff; object-fit: cover; box-shadow: var(--shadow); background: #fff; margin-top: -82px; flex-shrink: 0; }
.p-id { flex: 1; min-width: 220px; padding-bottom: .3rem; }
.p-id h1 { margin: 0 0 .2rem; font-size: 1.7rem; color: var(--text); }
.p-id .role { color: var(--text-soft); font-weight: 500; font-size: 1.02rem; }
.p-id .tags { margin-top: .7rem; display: flex; gap: .45rem; flex-wrap: wrap; }
.p-tag { padding: .28rem .75rem; border-radius: 999px; font-size: .74rem; font-weight: 700; background: #eff6ff; color: var(--primary-dark); }
.p-tag.staff { background: #f0fdfa; color: #0f766e; }
.p-tag.muted { background: #f1f5f9; color: var(--text-soft); }

/* two-column body */
.p-layout { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; align-items: start; }
.p-main { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }

.p-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem 1.5rem; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.p-block h3 { display: flex; align-items: center; gap: .6rem; font-size: 1.08rem; margin: 0 0 1rem; padding-bottom: .8rem; border-bottom: 1px solid var(--border); }
.p-ic { width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; background: var(--primary); color: #fff; flex-shrink: 0; }
.p-ic svg { width: 17px; height: 17px; }
.p-count { margin-left: auto; background: #eff6ff; color: var(--primary-dark); font-size: .74rem; font-weight: 800; padding: .15rem .6rem; border-radius: 999px; }

.p-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1.1rem 1.5rem; }
.p-info .k { font-size: .7rem; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); font-weight: 700; display: block; margin-bottom: .15rem; }
.p-info .v { font-size: .96rem; word-break: break-word; font-weight: 500; }
.p-bio { color: var(--text-soft); margin: 0; line-height: 1.65; }
.p-chips { margin-top: .9rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.p-chip { background: #eff6ff; color: var(--primary-dark); font-size: .76rem; font-weight: 600; padding: .25rem .7rem; border-radius: 999px; }

/* custom section entries */
.p-entries { list-style: none; margin: 0; padding: 0; }
.p-entries li { display: flex; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--border); }
.p-entries li:first-child { padding-top: 0; }
.p-entries li:last-child { border-bottom: none; padding-bottom: 0; }
.p-entry-label { flex: 0 0 34%; font-weight: 700; color: var(--text); font-size: .92rem; }
.p-entry-value { flex: 1; color: var(--text-soft); font-size: .92rem; }
.p-entry-value.full { flex: 1; color: var(--text); }
.p-entries li::before { content: ""; }

/* documents */
.p-docs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.p-docs li { display: flex; align-items: center; gap: .9rem; padding: .7rem .8rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.p-doc-ic { width: 40px; height: 40px; border-radius: 8px; background: #fee2e2; color: #dc2626; display: grid; place-items: center; flex-shrink: 0; }
.p-doc-meta { flex: 1; min-width: 0; }
.p-doc-meta b { display: block; font-size: .9rem; }
.p-doc-meta small { color: var(--text-muted); font-size: .76rem; }

/* sidebar */
.p-side { display: flex; flex-direction: column; gap: 1.25rem; position: sticky; top: 84px; }
.p-qr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; text-align: center; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.p-qr h4 { margin: 0 0 1rem; font-size: .82rem; text-transform: uppercase; letter-spacing: .5px; color: var(--text-soft); }
.p-qr .qr { display: inline-block; padding: .7rem; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.p-qr small { display: block; margin-top: .8rem; color: var(--text-muted); font-size: .76rem; }

.p-contact-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.4rem; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.p-contact-card h4 { margin: 0 0 .9rem; font-size: .82rem; text-transform: uppercase; letter-spacing: .5px; color: var(--text-soft); }
.p-contact-link { display: flex; align-items: center; gap: .8rem; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: 10px; color: var(--text); margin-bottom: .6rem; transition: background .15s, border-color .15s, transform .08s; }
.p-contact-link:last-child { margin-bottom: 0; }
.p-contact-link:hover { background: var(--primary-soft, #eff6ff); border-color: #bfdbfe; text-decoration: none; transform: translateX(2px); }
.p-contact-ic { width: 38px; height: 38px; border-radius: 9px; background: var(--primary); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.p-contact-ic svg { width: 18px; height: 18px; }
.p-contact-txt { display: flex; flex-direction: column; min-width: 0; }
.p-contact-txt small { font-size: .68rem; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); font-weight: 700; }
.p-contact-txt b { font-size: .9rem; font-weight: 600; word-break: break-word; color: var(--primary-dark); }

/* document preview modal */
.doc-modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .6); display: none; align-items: center; justify-content: center; z-index: 100; padding: 1rem; }
.doc-modal.open { display: flex; }
.doc-modal__box { background: #fff; border-radius: 14px; width: 100%; max-width: 920px; overflow: hidden; display: flex; flex-direction: column; max-height: 92vh; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.doc-modal__head { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.doc-modal__head b { flex: 1; font-size: 1rem; }
.doc-modal__x { background: none; border: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--text-muted); }
.doc-modal__x:hover { color: var(--text); }
.doc-modal__body { flex: 1; min-height: 60vh; background: #f1f5f9; }
.doc-modal__body iframe { width: 100%; height: 70vh; border: none; display: block; }
.doc-modal__img { height: 70vh; display: flex; align-items: center; justify-content: center; padding: 1rem; overflow: auto; }
.doc-modal__img img { max-width: 100%; max-height: 100%; border-radius: 6px; }
.doc-modal__foot { display: flex; justify-content: flex-end; gap: .6rem; padding: 1rem 1.25rem; border-top: 1px solid var(--border); }

.pub-footer { text-align: center; color: var(--text-muted); font-size: .82rem; padding: 1.5rem; }
.not-found { text-align: center; padding: 5rem 1.5rem; }
.not-found h1 { font-size: 3rem; margin: 0; color: var(--primary); }

.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1rem; border-radius: 10px; font-weight: 600; font-size: .9rem; background: #fff; border: 1px solid var(--border); color: var(--text); cursor: pointer; }
.btn:hover { text-decoration: none; background: #f8fafc; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn svg { width: 16px; height: 16px; }

@media (max-width: 860px) {
    .p-layout { grid-template-columns: 1fr; }
    .p-side { position: static; flex-direction: row; flex-wrap: wrap; }
    .p-qr, .p-contact-card { flex: 1 1 260px; }
    .p-cover { height: 180px; }
}
@media (max-width: 540px) {
    .p-head { padding: 0 1.25rem 1.25rem; gap: 1rem; }
    .p-avatar { width: 112px; height: 112px; margin-top: -64px; }
    .p-id h1 { font-size: 1.4rem; }
    .p-block { padding: 1.1rem 1.1rem; }
    .p-entries li { flex-direction: column; gap: .15rem; }
    .p-entry-label { flex: none; }
    .dir-hero h1 { font-size: 1.5rem; }
}
