/*
Theme Name: ResearchHK 港研誌
Description: 香港科研與高等教育新聞主題。支援文章、分類、搜尋及可選的首批文章匯入。
Version: 1.8.1
Requires at least: 6.2
Requires PHP: 7.4
Text Domain: researchhk
*/
:root{--ink:#143746;--muted:#48636b;--paper:#fff;--surface:#edf7f6;--line:#c9e1e2;--accent:#126555;--serif:"Noto Serif HK","Songti TC","PMingLiU",Georgia,serif;--sans:"Noto Sans HK","PingFang HK","Microsoft JhengHei",Arial,sans-serif}
*{box-sizing:border-box}body{margin:0;font:1rem/1.65 var(--sans);background:var(--paper);color:var(--ink)}a{color:inherit;text-decoration:none}a:hover{color:var(--accent)}a:focus-visible,button:focus-visible,input:focus-visible,summary:focus-visible{outline:3px solid var(--accent);outline-offset:3px}img{display:block;width:100%;height:auto}button,input{font:inherit}h1,h2,h3,p,ul{margin:0}h1,h2,h3{line-height:1.35}p+p{margin-top:.9rem}.shell{width:min(1232px, calc(100% - 5rem));margin-inline:auto}.skip{position:absolute;left:1rem;top:-10rem;background:white;padding:.6rem;z-index:30}.skip:focus{top:1rem}
.top{background:#eaf5fa;color:var(--ink);font-size:.84rem}.top .shell{min-height:34px;display:flex;align-items:center;justify-content:space-between;gap:1rem}.top a:hover{color:var(--accent);text-decoration:underline}.mast{display:flex;justify-content:space-between;align-items:center;gap:2rem;min-height:117px}.wordmark{display:inline-flex;align-items:center;gap:.95rem;white-space:nowrap}.mark{display:grid;grid-template-columns:repeat(2,11px);gap:4px;align-content:center;justify-content:center;width:45px;height:45px;border-radius:4px;background:var(--accent);flex:none}.mark i{display:block;background:#fff;height:11px}.mark i:nth-child(2){border-radius:0 10px 0 0}.mark i:nth-child(3){border-radius:0 0 0 10px}.mark i:nth-child(4){opacity:.53}.name{display:flex;align-items:center;gap:.8rem}.name strong{font:700 2.65rem/1 var(--serif);letter-spacing:.07em}.name small{font:700 1.1rem/1 Georgia,serif;letter-spacing:.025em;border-left:1px solid var(--line);padding-left:.8rem}.sub{font-size:.86rem;color:var(--muted);margin:.55rem 0 0 60px;letter-spacing:.06em}
.rh-search{display:flex;width:min(100%,255px);height:42px;border:1px solid var(--line);background:#f7fcfd}.rh-search input{width:100%;min-width:0;border:0;background:transparent;padding:0 .7rem;color:var(--ink);font-size:.9rem}.rh-search button{background:none;border:none;padding:0 .75rem;color:var(--ink);cursor:pointer;white-space:nowrap;font-size:.84rem;font-weight:700}
.nav{border-top:2px solid var(--ink);border-bottom:1px solid var(--line);display:flex;gap:.3rem 1.8rem;min-height:51px;align-items:stretch;flex-wrap:wrap}.nav a{font-size:.94rem;font-weight:700;display:flex;align-items:center;min-height:48px;position:relative;white-space:nowrap}.nav a[aria-current]{color:var(--accent)}.nav a[aria-current]:after{content:"";height:3px;position:absolute;bottom:-1px;left:0;right:0;background:var(--accent)}
main.shell{padding-block:35px 60px}.section-title{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:18px}.section-title h1,.section-title h2{font:700 clamp(1.55rem,3vw,2rem)/1.3 var(--serif);padding-left:.65rem;border-left:4px solid var(--accent)}.section-title>a{font-size:.9rem;color:var(--muted);white-space:nowrap}.tag{font-weight:700;font-size:.83rem;letter-spacing:.06em;color:var(--accent);display:inline-block}
.section{margin-top:40px;border-top:1px solid var(--line);padding-top:22px}.cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:25px}.card{padding-bottom:16px;border-bottom:1px solid var(--line)}.card-media{display:block;background:var(--surface);aspect-ratio:1.85;overflow:hidden;margin-bottom:.85rem}.card-media img{height:100%;object-fit:cover}.card h2,.card h3{margin:.23rem 0 .5rem;font:700 1.35rem/1.45 var(--serif)}.card p{font-size:.93rem;color:var(--muted)}.no-media{color:var(--ink);background:var(--surface);display:grid;place-items:center;padding:1rem;font:700 1.45rem/1.3 var(--serif);letter-spacing:.13em}.no-media:hover{color:var(--accent)}.directory{display:grid;grid-template-columns:repeat(3,1fr);gap:1rem}.directory a{background:var(--surface);padding:1rem;border-left:2px solid var(--line);display:block}.directory a:hover{border-color:var(--accent)}.directory strong,.directory span{display:block}.directory span{color:var(--muted);font-size:.88rem}
.footer{background:#eaf7f3;color:var(--ink);padding:1.6rem 0}.footer .shell{display:flex;justify-content:space-between;gap:1rem;flex-wrap:wrap;font-size:.88rem}.footer a:hover{color:var(--accent);text-decoration:underline}.article{max-width:820px;margin-inline:auto}.article h1{font:700 clamp(2rem,5vw,3.1rem)/1.3 var(--serif);margin:.5rem 0 .8rem}.article .meta{font-size:.91rem;color:var(--muted);margin-bottom:1.35rem}.article img{max-height:430px;object-fit:cover;margin-bottom:1.4rem}.article .copy{font-size:1.09rem;line-height:1.95}.copy>*+*{margin-top:1.05rem}.copy a,.article .back,.empty a,.content-link{color:var(--accent);text-decoration:underline;text-underline-offset:3px}.copy ul,.copy ol{padding-left:1.45em}.copy h2{font-size:1.55rem}.pagination{margin-top:1.5rem}.page-numbers{display:inline-block;padding:.25rem .55rem;border:1px solid var(--line);margin-right:.22rem}.page-numbers.current{background:var(--ink);color:white}.empty{background:var(--surface);padding:1.3rem}.index-links{margin-top:1.1rem}.deadline{color:var(--accent);font-weight:700}.sr-only,.screen-reader-text{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}[hidden]{display:none!important}
@media(max-width:950px){.shell{width:calc(100% - 3rem)}.cards{gap:17px}.nav{gap:.3rem 1.25rem}}
@media(max-width:700px){.shell{width:calc(100% - 2rem)}.mast{min-height:auto;padding-block:17px;display:grid;gap:.85rem}.name strong{font-size:2rem}.name small{font-size:1rem}.mark{width:37px;height:37px}.wordmark{gap:.7rem}.sub{margin-left:48px}.rh-search{width:100%}.nav{gap:0 1.05rem}.nav a{min-height:40px;font-size:.88rem}.top .shell{font-size:.78rem}main.shell{padding-top:23px}.directory{grid-template-columns:1fr}.cards{grid-template-columns:repeat(2,minmax(0,1fr))}.section{margin-top:29px}.card h2,.card h3{font-size:1.18rem}}
@media(max-width:430px){.cards{grid-template-columns:1fr}.top .shell>span{max-width:65%}}

.top-actions,.languages{display:flex;align-items:center;gap:.75rem}.languages{border-left:1px solid #557078;padding-left:.75rem;gap:.6rem;white-space:nowrap}.languages [aria-current]{font-weight:700;text-decoration:underline;text-underline-offset:3px}.nav a{min-width:0}
@media(max-width:700px){.top .shell{padding-block:6px}.top-actions{margin-left:auto}.top-actions>a{display:none}.languages{border-left:0;padding-left:0}.sub{letter-spacing:0}}

.funding-intro{color:var(--muted);max-width:64rem}.funding-nav{color:var(--accent)}.funding-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}.funding-item{border:1px solid var(--line);border-top:3px solid var(--ink);padding:1rem 1.2rem;scroll-margin-top:1rem}.funding-item:target{border-color:var(--accent)}.funding-item h3{font:700 1.35rem/1.4 var(--serif);margin:.3rem 0}.funding-item .funding-amount{font-weight:700;margin-top:.4rem;color:var(--muted)}.funding-item .funding-date{margin-top:.55rem;padding:.35rem .55rem;background:var(--surface)}.funding-sources{margin-top:.8rem;padding-left:1.2rem;font-size:.89rem}.funding-sources a{color:var(--accent);text-decoration:underline;text-underline-offset:3px}.funding-item p{overflow-wrap:anywhere}@media(max-width:700px){.funding-grid{grid-template-columns:1fr}}

/* Keep text on lightly tinted surfaces when the gradient colours are customised. */
:root {
  --brand-start: #c9e9fb;
  --brand-end: #d0f2df;
  --brand-gradient: linear-gradient(112deg, var(--brand-start), var(--brand-end));
  --brand-tint: linear-gradient(112deg,
    color-mix(in srgb, var(--brand-start) 42%, white),
    color-mix(in srgb, var(--brand-end) 42%, white));
}
body > header {
  background: #eff9fc;
  background: var(--brand-gradient, #eff9fc);
}
.top {
  border-bottom: 1px solid rgba(20,55,70,.13);
  background: transparent;
}
.languages { border-color: rgba(20,55,70,.27); }
.nav { border-top-color: #88b6bb; }
.mark { background: linear-gradient(145deg, #14778b, #13725c); }
.directory a, .no-media, .footer {
  background: #edf7f6;
  background: var(--brand-tint, #edf7f6);
}
.funding-item { border-top-color: #78adac; }
.funding-item .funding-date { background: var(--brand-tint, #edf7f6); }
main#content + .footer::before {
  content: "";
  display: block;
  height: 4px;
  margin-top: -1.6rem;
  margin-bottom: 1.6rem;
  background: var(--brand-gradient);
}

.rh-search { flex: 0 1 255px; }
.rh-archive-description { color: var(--muted); margin-bottom: 1.4rem; }
.article-wide { max-width: none; }
.article .copy { overflow-wrap: anywhere; }
.article .copy iframe { max-width: 100%; }
.article .copy .wp-block-table { overflow-x: auto; }
.section-title h1, .article h1, .empty { overflow-wrap: anywhere; }

.rh-share {
  border-top: 1px solid var(--line);
  margin-top: 2rem;
  padding: 1.1rem 0 0;
}
.rh-share h2 { font-size: 1.08rem; margin-bottom: .65rem; }
.rh-share-links { display: flex; flex-wrap: wrap; gap: .45rem; }
.rh-share-links a, .rh-share-links button {
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .25rem;
  padding: .38rem .7rem;
  font-size: .9rem;
  cursor: pointer;
}
.rh-share-links a:hover, .rh-share-links button:hover { border-color: var(--accent); }
.rh-share-address { margin-top: .55rem; font-size: .84rem; color: var(--muted); }
.rh-share-address summary { cursor: pointer; width: fit-content; }
.rh-share-address input { width: min(100%, 38rem); margin-top: .4rem; padding: .4rem; }
.rh-share-status { margin-top: .35rem; color: var(--accent); }
.rh-share-status:empty { display: none; }
.rh-article-embed { display: block; width: 100%; min-height: 24rem; height: 36rem; border: 0; }

.rh-news-story { max-width: 880px; }
.rh-news-story .back { display: inline-block; margin-bottom: .85rem; }
.rh-news-heading {
  padding: clamp(1.15rem, 3.5vw, 2rem);
  border-block-start: 5px solid #126555;
  background: var(--brand-gradient, #e2f3f9);
  color: #123440;
  margin-bottom: clamp(1.3rem, 3vw, 2rem);
}
.rh-news-heading h1 {
  font-size: clamp(1.75rem, 4.5vw, 2.8rem);
  margin: .38rem 0 .6rem;
  letter-spacing: -.012em;
}
.rh-news-heading .meta { margin: .65rem 0; color: #294f5b; }
.rh-news-lead {
  border-inline-start: 3px solid #177362;
  padding-inline-start: .85rem;
  margin-top: .9rem;
  font-size: clamp(1rem, 2.1vw, 1.18rem);
  line-height: 1.65;
}
.rh-news-story .copy { max-width: 70ch; margin-inline: auto; }
.rh-news-story .copy h2 {
  margin-top: 1.65rem;
  padding-top: .6rem;
  border-top: 1px solid var(--line);
  font-size: 1.08rem;
}

.lead-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.05fr) minmax(250px, 1fr);
  align-items: start;
  gap: clamp(1rem, 2.5vw, 2rem);
}
.lead-single { grid-template-columns: minmax(0, 1fr); }
.hero {
  display: block;
  overflow: hidden;
  border: 1px solid #b7d8de;
  border-radius: 10px;
  background: #d8f1ed;
  background: var(--brand-gradient, #d8f1ed);
  color: var(--ink);
}
.hero-media { background: var(--surface); }
.hero-media img {
  height: clamp(9rem, 17vw, 14rem);
  object-fit: cover;
}
.hero-inner {
  max-width: 54rem;
  padding: clamp(1.35rem, 3.2vw, 2.6rem);
}
.hero .tag {
  padding: .2rem .55rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, .7);
}
.hero-title {
  margin: .7rem 0;
  font: 700 clamp(1.55rem, 3vw, 2.45rem)/1.3 var(--serif);
  letter-spacing: -.015em;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.hero-inner p { max-width: 66ch; color: #2c5262; overflow-wrap: anywhere; }
.hero-read {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin-top: 1.2rem;
  padding: .5rem .8rem;
  border-radius: 5px;
  background: var(--accent);
  color: white;
  font-size: .88rem;
  font-weight: 700;
}
.briefs {
  padding: 1.2rem clamp(1rem, 2vw, 1.55rem) .55rem;
  border: 1px solid var(--line);
  border-top: 4px solid #2e8e85;
  border-radius: 8px;
  background: #f5fafb;
  background: var(--brand-tint, #f5fafb);
}
.brief-heading { font: 700 1.35rem/1.35 var(--serif); margin: 0 0 .25rem; }
.briefs article { padding: .8rem 0; border-bottom: 1px solid var(--line); }
.briefs article:last-child { border-bottom: 0; }
.brief-title { font-size: 1.03rem; line-height: 1.4; margin: .25rem 0 0; overflow-wrap: anywhere; }
.briefs article p { font-size: .85rem; color: var(--muted); margin-top: .3rem; overflow-wrap: anywhere; }
.rh-home-page { margin-bottom: 2rem; }
@media (max-width: 700px) {
  .lead-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-inner p { font-size: .93rem; }
}

/* Keep the wordmark and independently playable video within the news grid. */
.wordmark { max-width: 100%; }
.rh-logo-image { width: auto; height: auto; max-width: min(280px, 100%); max-height: 64px; object-fit: contain; }
.wordmark:has(.rh-logo-image) + .sub { margin-left: 0; }
.mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: #e8f8fc;
  border: 1px solid #b7d8de;
  border-radius: 5px;
}
.mark i {
  width: 12px;
  height: 17px;
  background: #237ca3;
  border-radius: 2px 4px 0 2px;
  transform: skewY(12deg);
}
.mark i:nth-child(2) {
  background: #278467;
  border-radius: 4px 2px 2px 0;
  transform: skewY(-12deg);
}
.hero-media { display: block; }
.hero-title a:hover { text-decoration: underline; }
.hero-read:hover { color: white; text-decoration: underline; }
.rh-home-video { margin: 0; background: #142d37; color: white; }
.rh-home-video figcaption { padding: .45rem .85rem; font-size: .85rem; font-weight: 700; }
.rh-home-video video { display: block; width: 100%; aspect-ratio: 16 / 9; max-height: 410px; background: #0b1b22; }
.rh-news-details { margin-top: 1.5rem; }
.rh-news-details > * + * { margin-top: .65rem; }
.rh-credit img { margin-bottom: .4rem; }
.rh-credit { margin: 0 0 1.3rem; }
.rh-credit figcaption { font-size: .86rem; color: var(--muted); }
.rh-correction { padding: .8rem 1rem; background: var(--surface); border-inline-start: 3px solid var(--accent); }
