/* ============================================================
   AKIT v2 — design tokens sampled from v1 page renders
   ============================================================ */
:root {
  /* gold header (top-nav.png: #DFBB57 top -> #FDF7C7 bottom) */
  --gold-deep: #dfbb57;
  --gold-mid: #f3db91;
  --gold-pale: #fdf7c7;
  /* page background (about page: #F4E19C -> #FFFCDF -> #fff) */
  --page-top: #f4e19c;
  --page-mid: #fffcdf;
  /* landing greens */
  --green-pale: #f4faee;
  --green-mid: #eaf4dc;
  --green-deep: #b8da90;
  /* org chart */
  --org-red: #ed1a2e;
  --org-yellow: #f9ef44;
  --org-blue: #4464af;
  --org-link: #fbf593;
  --org-link-edge: #d8c87a;
  /* misc */
  --card-shadow-gold: #dbb959;
  --heading-blue: #2f6eb5;
  --ink: #1a1a1a;
  --font-main: "Source Sans 3", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-serif: "Times New Roman", Times, serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; }

body {
  font-family: var(--font-main);
  color: var(--ink);
  background: linear-gradient(180deg, var(--page-top) 0%, var(--page-mid) 42%, #ffffff 100%) no-repeat;
  background-color: #ffffff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }

/* grid/flex items must be allowed to shrink below img intrinsic width */
.about-top > *, .about-bottom > *, .pub-layout > *, .activity-cols > *,
.photo-grid > *, .news-grid > *, .shelf-books > *, .org-row-principal > * {
  min-width: 0;
}
body { overflow-x: hidden; }
a { color: inherit; text-decoration: none; }

.container {
  width: min(1180px, 92vw);
  margin: 0 auto;
}

/* accessible page headings that don't alter the visual design */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   Header / navigation (replaces top-nav.png + invisible buttons)
   ============================================================ */
.site-header {
  background: linear-gradient(180deg, var(--gold-deep) 0%, var(--gold-mid) 48%, var(--gold-pale) 100%);
  padding: 2.2rem 1rem 2rem;
  text-align: center;
}

.site-header .brand {
  display: inline-block;
}

.site-header .brand img {
  width: clamp(96px, 12vw, 150px);
  margin: 0 auto;
}

.site-header .brand-name {
  font-weight: 700;
  font-size: clamp(1.15rem, 2.6vw, 1.9rem);
  letter-spacing: 0.01em;
  margin-top: 0.9rem;
  color: #000;
}

.main-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(0.6rem, 2.4vw, 2.2rem);
  margin-top: 1.6rem;
}

.main-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.main-nav .pill {
  background: #fff;
  border-radius: 999px;
  padding: 0.42em 1.6em;
  font-weight: 700;
  font-size: clamp(0.95rem, 1.7vw, 1.35rem);
  letter-spacing: 0.28em;
  text-indent: 0.28em; /* balance letter-spacing */
  box-shadow: 4px 5px 0 rgba(186, 148, 42, 0.5);
  white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.main-nav .label {
  font-weight: 700;
  font-size: clamp(0.8rem, 1.4vw, 1.1rem);
  color: #000;
  white-space: nowrap;
}

.main-nav a:hover .pill,
.main-nav a:focus-visible .pill {
  transform: translate(1px, 1px);
  box-shadow: 2px 3px 0 rgba(186, 148, 42, 0.5);
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  margin-top: auto;
  text-align: center;
  padding: 2.5rem 1rem 1.6rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ============================================================
   Landing page (index.php)
   ============================================================ */
body.landing {
  background:
    radial-gradient(120% 90% at 50% 30%, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(160deg, var(--green-pale) 0%, var(--green-mid) 55%, var(--green-deep) 130%);
  background-color: var(--green-mid);
}

.landing-swoosh {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  height: 45vh;
  pointer-events: none;
  z-index: 0;
}

.landing-main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(2.5rem, 6vh, 4.5rem);
  padding: 15vh 1rem 2rem;
}

.landing-logo img {
  width: clamp(160px, 18vw, 250px);
  margin: 0 auto;
  transition: transform 0.15s ease;
}

.landing-logo:hover img { transform: scale(1.03); }

.landing-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: clamp(3rem, 18vw, 22rem);
}

.landing-links img {
  height: clamp(60px, 9vw, 110px);
  width: auto;
  transition: transform 0.15s ease;
}

.landing-links a:hover img { transform: scale(1.05); }

body.landing .site-footer { position: relative; z-index: 1; }

/* ============================================================
   Shared content blocks
   ============================================================ */
.page-main { padding: 2.5rem 0 1rem; }

.gold-card {
  --card-pad: clamp(1.4rem, 3vw, 2.6rem);
  background: linear-gradient(180deg, #f7d964 0%, #faf3c7 100%);
  border: 3px solid #e7c14c;
  border-radius: 26px;
  padding: var(--card-pad);
}

.gold-card .card-logo {
  width: clamp(110px, 14vw, 170px);
  margin: 0 auto 1.6rem;
}

.cn-text p {
  font-size: clamp(0.98rem, 1.45vw, 1.15rem);
  line-height: 1.95;
  text-align: justify;
  text-justify: inter-ideograph;
  margin-bottom: 1em;
}

.cn-text p.en { line-height: 1.65; }

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

/* skyline decoration: buildings live INSIDE the card — full-bleed to its
   edges so the rounded border clips the outermost buildings (as in v1).
   The faded reflection sits outside, directly below the card. */
.has-skyline.has-skyline {
  overflow: hidden;
  padding-bottom: 0;
}
.skyline-in {
  margin: 1.5rem calc(-1 * var(--card-pad, 1.5rem)) 0;
  pointer-events: none;
}
.skyline-in img { width: 100%; display: block; margin-bottom: -1px; }
.skyline-reflection { pointer-events: none; }
.skyline-reflection img {
  width: 100%;
  transform: scaleY(-1);
  opacity: 0.3;
  -webkit-mask-image: linear-gradient(0deg, transparent 15%, #000 100%);
  mask-image: linear-gradient(0deg, transparent 15%, #000 100%);
}

/* photo grids */
.photo-grid {
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.photo-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================================
   Home / About page
   ============================================================ */
.about-top {
  display: grid;
  grid-template-columns: minmax(300px, 2fr) 3fr;
  gap: clamp(1.2rem, 3vw, 2.5rem);
  align-items: start;
}

.about-photos { grid-template-columns: 1fr 1.6fr; }

.about-bottom {
  display: grid;
  grid-template-columns: 3fr minmax(300px, 2.4fr);
  gap: clamp(1.2rem, 3vw, 2.5rem);
  align-items: start;
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.9rem;
}

.news-grid img {
  box-shadow: 2px 3px 6px rgba(120, 90, 20, 0.25);
}

.cw-card .card-logo { width: clamp(180px, 22vw, 300px); }

/* ============================================================
   Org chart
   ============================================================ */
.org-chart {
  --link-w: 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 0 3rem;
}

.org-node {
  border-radius: 10px;
  padding: 0.8em 1.4em;
  text-align: center;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 2px 3px 5px rgba(120, 90, 20, 0.18);
}

.org-node .cn { display: block; font-size: 1.05em; }
.org-node .en { display: block; font-size: 0.82em; letter-spacing: 0.06em; }

.org-node.red { background: var(--org-red); color: #fff; }
.org-node.yellow { background: var(--org-yellow); color: #000; }
.org-node.blue { background: var(--org-blue); color: #fff; }

.org-link-v {
  width: var(--link-w);
  height: 2.2rem;
  background: var(--org-link);
}

/* symmetric grid tracks keep the principal centered on the spine
   regardless of the side nodes' text width */
.org-row-principal {
  display: grid;
  grid-template-columns: 1fr clamp(2rem, 9vw, 210px) auto clamp(2rem, 9vw, 210px) 1fr;
  align-items: center;
  width: 100%;
}

.org-row-principal > .org-node { width: 100%; }
.org-row-principal > .org-node.red { width: auto; }

.org-link-h {
  height: var(--link-w);
  width: 100%;
  background: var(--org-link);
}

/* departments: five columns, each column = head + sub-nodes */
.org-branches {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  width: 100%;
  margin-top: 0;
  position: relative;
  padding-top: 2.2rem;
}

/* horizontal distribution bar — ends exactly at the outer columns' centers
   (5 equal columns with 1rem gaps: first center = 10% - 0.4rem) */
.org-branches::before {
  content: "";
  position: absolute;
  top: 0;
  left: calc(10% - 0.4rem);
  right: calc(10% - 0.4rem);
  height: var(--link-w);
  background: var(--org-link);
}

.org-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.org-col::before {
  content: "";
  width: var(--link-w);
  height: calc(2.2rem + var(--link-w));
  margin-top: -2.2rem;
  background: var(--org-link);
}

.org-col .org-node { width: 100%; }
.org-col .org-node + .org-node { margin-top: 0; }

/* ============================================================
   Publication page
   ============================================================ */
.pub-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 2.3fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
}

.pub-text {
  --card-pad: clamp(1.4rem, 3vw, 2.4rem);
  border: 3px solid #e7c14c;
  background: rgba(255, 255, 240, 0.55);
  padding: var(--card-pad);
}

.shelf { margin-bottom: 2.6rem; }

.shelf-books {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(0.7rem, 1.6vw, 1.6rem);
  align-items: end;
  padding: 0 1.2rem;
}

.shelf-books img {
  box-shadow: 3px 4px 8px rgba(120, 90, 20, 0.3);
}

.shelf-board {
  height: 16px;
  margin-top: 0;
  background: linear-gradient(180deg, #f0d472 0%, #d9ab3c 100%);
  box-shadow: 0 6px 8px rgba(150, 110, 30, 0.25);
}

.shelf-board::after {
  content: "";
  display: block;
  height: 10px;
  background: linear-gradient(180deg, #c89a30 0%, rgba(200, 154, 48, 0) 100%);
  clip-path: polygon(2% 0, 98% 0, 92% 100%, 8% 100%);
}

/* ============================================================
   Contact page
   ============================================================ */
.contact-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(3rem, 9vh, 7rem) 1rem 3rem;
}

.contact-card {
  background: #fff;
  border-radius: clamp(40px, 6vw, 70px);
  box-shadow: 22px 24px 0 var(--card-shadow-gold);
  padding: clamp(2.2rem, 5vw, 4rem) clamp(2.5rem, 6vw, 5.5rem);
  max-width: 720px;
}

.contact-card .cn-name {
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  letter-spacing: 0.35em;
}

.contact-card .en-name {
  font-weight: 700;
  font-size: clamp(1.05rem, 2.2vw, 1.5rem);
  margin-bottom: 0.5em;
}

.contact-card address {
  font-style: normal;
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 2.2vw, 1.5rem);
  line-height: 1.5;
}

.contact-card .contact-line {
  margin-top: 0.9em;
  font-family: var(--font-serif);
  font-size: clamp(1rem, 2vw, 1.35rem);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em 2.5em;
}

.contact-card .contact-line b { font-family: var(--font-main); }

.contact-card .contact-line a {
  display: inline-flex;
  align-items: center;
  min-height: 44px; /* touch target */
  text-decoration: underline transparent;
  transition: text-decoration-color 0.15s ease;
}

.contact-card .contact-line a:hover,
.contact-card .contact-line a:focus-visible {
  text-decoration-color: var(--card-shadow-gold);
}

/* ============================================================
   Activities page
   ============================================================ */
.activity {
  background: #fff;
  border-radius: 6px;
  padding: clamp(1.5rem, 4vw, 3rem);
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
  box-shadow: 0 2px 10px rgba(150, 120, 40, 0.12);
}

.activity h2 {
  color: var(--heading-blue);
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  font-weight: 700;
  margin-bottom: 0.9em;
}

.activity .meta {
  font-weight: 700;
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  margin-bottom: 1.4em;
}

.activity .meta span + span { margin-left: 2.5em; }

.activity-cols {
  display: grid;
  gap: clamp(1.2rem, 3vw, 2.2rem);
  align-items: start;
}

.activity-cols.text-media { grid-template-columns: 1.15fr 1fr; }
/* narrow media rail (posters/clippings) as in v1 */
.activity-cols.cols-narrow-side { grid-template-columns: 2.2fr 1fr; }
/* narrow cover on the left, text right */
.activity-cols.cols-cover { grid-template-columns: 1fr 2.6fr; }

.activity figure img { margin: 0 auto; }

.activity .full { margin-top: 1.6rem; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .about-top, .about-bottom, .pub-layout,
  .activity-cols.text-media, .activity-cols.cols-narrow-side,
  .activity-cols.cols-cover { grid-template-columns: 1fr; }
  .about-bottom .news-grid { order: 2; }
  .org-branches { grid-template-columns: 1fr; padding-top: 0; }
  .org-branches::before, .org-col::before { display: none; }
  .org-col { gap: 0; margin-bottom: 1rem; }
  /* stack principal row so the red node is never crushed */
  .org-row-principal { display: flex; flex-direction: column; gap: 0; }
  .org-row-principal > .org-node.red { width: auto; }
  .org-row-principal .org-link-h {
    width: var(--link-w);
    height: 2.2rem;
    max-width: none;
    flex: none;
    border: 0;
    border-left: 1px solid var(--org-link-edge);
    border-right: 1px solid var(--org-link-edge);
  }
  /* restore reading order: principal first, then the two lateral units */
  .org-row-principal .org-node.red { order: -2; }
  .org-row-principal .org-link-h:first-of-type { order: -1; }
  .contact-card { box-shadow: 12px 14px 0 var(--card-shadow-gold); }
}

@media (max-width: 560px) {
  .news-grid { grid-template-columns: repeat(2, 1fr); }
  /* shelves keep 5 covers per board (as v1 scales) so books never float off their shelf */
  .shelf-books { gap: 0.5rem; padding: 0 0.6rem; }
  .main-nav ul { gap: 0.6rem 0.9rem; }
  .main-nav .pill { letter-spacing: 0.12em; text-indent: 0.12em; }
}
