/* Country x field pages (/phd/...). Loaded after home.css and built on its
   white + blue look (page-home tokens, hm- components); only page-specific
   pieces live here, prefixed tp-. */

/* hero */
/* Field names can be long ("مهندسی پزشکی و تصویربرداری پزشکی"): let the title wrap
   instead of the home page's one-line rule, and keep it clear of the card. */
.page-topics .hm-hero h1 span { white-space: normal; }
.page-topics .hm-hero h1 { font-size: clamp(28px, 3.1vw, 40px); }
.tp-crumbs { margin: 0 0 18px; }
.tp-crumbs a { color: var(--ink-2); }
.tp-cta { margin-top: 28px; }
.tp-cta .hm-btn svg { width: 16px; height: 16px; }
.tp-hero-single { padding-block: 48px 56px; }
.tp-hero-single .hm-lead { max-width: 60ch; }
.tp-avatar { font-size: 1.15rem; }
.tp-who { direction: rtl !important; text-align: start !important; letter-spacing: 0 !important; }
.tp-dossier .hm-ring .fg.tp-fund { stroke: var(--green); }
.tp-dossier .hm-ring .bg { stroke: var(--green-wash); }

/* sections */
.page-topics .hm-section.tp-sec { padding-block: 64px; }
.tp-tint { background: var(--hm-tint); border-block: 1px solid var(--line); }
.tp-head-row { max-width: none; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.tp-head-row h2 a { color: inherit; text-decoration: none; }
.tp-more { background: var(--blue-wash); color: var(--blue); }
.tp-more:hover { background: var(--hm-blue-line); color: var(--blue-ink); }

/* stats */
.tp-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 32px 0 0; }
.tp-stats > div { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.tp-stats dt { font-size: .8rem; font-weight: 700; color: var(--muted); }
.tp-stats dd { margin: 4px 0 0; font-size: 1.75rem; font-weight: 900; color: var(--ink); line-height: 1.3; }
.tp-stats .is-fund { background: var(--green-wash); border-color: transparent; }
.tp-stats .is-fund dd { color: var(--green); }
.tp-stats .is-early { background: var(--hm-violet-wash); border-color: transparent; }
.tp-stats .is-early dd { color: var(--hm-violet); }

/* professor list */
.tp-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.tp-card { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 16px; align-items: start; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; transition: border-color .2s, box-shadow .2s; }
.tp-card:hover { border-color: var(--hm-blue-line); box-shadow: var(--hm-shadow); }
.tp-rank { width: 40px; height: 40px; border-radius: 12px; display: grid; place-content: center; background: var(--blue-wash); color: var(--blue); font-weight: 900; }
.tp-main p { margin: 0; }
.tp-name { font-weight: 800; color: var(--ink); letter-spacing: .5px; text-align: right; }
.tp-inst { color: var(--ink-2); font-size: .9rem; margin-top: 2px !important; }
.tp-why { color: var(--muted); font-size: .84rem; margin: 6px 0 10px !important; line-height: 1.9; }
.tp-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tp-rel { text-align: center; min-width: 60px; }
.tp-rel b { display: block; font-size: 1.2rem; font-weight: 900; color: var(--blue); }
.tp-rel span { font-size: .72rem; color: var(--muted); }

.tp-gate { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; padding: 24px 26px; border-radius: 20px; background: var(--blue); color: #fff; box-shadow: 0 18px 44px rgba(21, 87, 255, .22); }
.tp-gate div { flex: 1 1 340px; }
.tp-gate strong { display: block; font-size: 1.1rem; font-weight: 900; margin-bottom: 4px; }
.tp-gate span { color: #dbe5ff; font-size: .9rem; line-height: 1.9; }

/* universities and funders */
.tp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 32px; }
.tp-panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px; }
.tp-panel h3 { font-size: 1rem; font-weight: 800; margin: 0 0 16px; }
.tp-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.tp-bars li { display: grid; grid-template-columns: minmax(0, 1fr) 96px 22px; align-items: center; gap: 12px; font-size: .86rem; }
.tp-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.tp-bar { height: 8px; border-radius: 99px; background: var(--blue-wash); overflow: hidden; }
.tp-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--blue), #4f86ff); }
.tp-bars b { color: var(--ink); font-weight: 800; }
.tp-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tp-chips li { display: inline-flex; align-items: center; gap: 8px; font-size: .84rem; font-weight: 700; padding: 5px 6px 5px 12px; border-radius: 999px; background: var(--green-wash); color: var(--green); }
.tp-chips b { background: #fff; border-radius: 99px; padding: 0 8px; font-size: .76rem; }

/* blue guide band */
.tp-guide-body { max-width: 760px; margin-top: 20px; }
.tp-guide-body p { color: #dbe5ff; line-height: 2.1; margin: 0 0 14px; }
.tp-guide-body a { color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(255, 255, 255, .45); }
.tp-guide-body a:hover { text-decoration-color: #fff; }

/* how it was built + own topic */
.tp-two { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 40px; align-items: start; }
.tp-p { color: var(--ink-2); line-height: 2.05; margin: 14px 0 0; }
.tp-kw { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 16px 0 0; }
.tp-kw span { color: var(--muted); font-size: .84rem; margin-inline-end: 4px; }
.tp-kw bdi { font-size: .8rem; background: var(--hm-tint); border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; color: var(--ink-2); }
.tp-own { background: var(--hm-tint); border: 1px solid var(--line); border-radius: 20px; padding: 24px; }
.tp-own h3 { font-size: 1.1rem; font-weight: 900; margin: 0; }
.tp-own > p { color: var(--ink-2); font-size: .92rem; margin: 6px 0 0; }
.tp-finder { margin-top: 18px; grid-template-columns: minmax(0, 1fr); }
.tp-finder .hm-go { grid-column: auto; grid-row: auto; width: 100%; height: 50px; }

/* tiles (country and index pages) */
.tp-tiles { list-style: none; margin: 32px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .tp-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .tp-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .tp-tiles { grid-template-columns: minmax(0, 1fr); } }
.tp-tiles a { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; height: 100%; padding: 20px 18px; background: #fff; border: 1px solid var(--line); border-radius: 18px; text-decoration: none; color: var(--ink); transition: border-color .2s, box-shadow .2s, transform .2s; }
.tp-tiles a:hover { border-color: var(--hm-blue-line); box-shadow: var(--hm-shadow); transform: translateY(-2px); }
.tp-tile-n { font-size: 1.9rem; font-weight: 900; color: var(--blue); line-height: 1; display: flex; align-items: baseline; gap: 6px; }
.tp-tile-n small { font-size: .8rem; font-weight: 700; color: var(--muted); }
.tp-tiles b { font-size: 1.02rem; font-weight: 800; }
.tp-tile-uni { color: var(--muted); font-size: .78rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-tile-go { position: absolute; top: 22px; inset-inline-end: 22px; color: var(--blue); opacity: .5; transition: opacity .2s, transform .2s; }
.tp-tiles a:hover .tp-tile-go { opacity: 1; transform: translateX(-3px); }

/* related links */
.tp-related { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 28px; margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); }
.tp-related h3 { font-size: 1rem; font-weight: 800; margin: 0 0 8px; }
.tp-related ul { list-style: none; margin: 0; padding: 0; }
.tp-related li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.tp-related li span { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.tp-related a { color: var(--ink); text-decoration: none; font-weight: 500; }
.tp-related a:hover { color: var(--blue); }

@media (max-width: 900px) {
  .tp-two { grid-template-columns: minmax(0, 1fr); }
  .tp-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .page-topics .hm-section.tp-sec { padding-block: 48px; }
  .tp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tp-stats dd { font-size: 1.45rem; }
  .tp-card { grid-template-columns: 34px minmax(0, 1fr); padding: 16px; gap: 12px; }
  .tp-rank { width: 34px; height: 34px; }
  .tp-rel { grid-column: 2; text-align: start; display: flex; align-items: baseline; gap: 6px; }
  .tp-rel b { display: inline; font-size: 1rem; }
  .tp-cta .hm-btn, .tp-gate .hm-btn { width: 100%; }
}

/* hero summary card (index and country pages) */
.tp-summary { gap: 16px; }
.tp-sum-head { display: grid; gap: 2px; }
.tp-sum-head b { font-size: 1.15rem; font-weight: 900; }
.tp-sum-head span { font-size: .82rem; color: var(--muted); }
.tp-sum-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tp-sum-rows a { display: grid; grid-template-columns: 10em minmax(0, 1fr) 2.8em; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; color: var(--ink); text-decoration: none; font-size: .88rem; font-weight: 700; transition: background-color .15s; }
.tp-sum-rows a:hover { background: var(--hm-tint); }
.tp-sum-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-sum-bar { height: 8px; border-radius: 99px; background: var(--green-wash); overflow: hidden; }
.tp-sum-bar i { display: block; height: 100%; border-radius: 99px; background: var(--green); }
.tp-sum-n { color: var(--green); text-align: end; }
.tp-sum-note { margin: 0; font-size: .75rem; color: var(--muted); }
@media (max-width: 480px) {
  .tp-sum-rows a { grid-template-columns: 8.5em minmax(0, 1fr) 2.6em; }
  .tp-sum-name { white-space: normal; line-height: 1.6; }
}
