/* ============================================================
   Jr-Chang Chen — faculty homepage
   Design: warm paper ground, ink/pine palette, goban-grid motif
   ============================================================ */

:root {
  --paper:      #F5F1E7;
  --paper-2:    #EFE9DA;
  --ink:        #1B1D1A;
  --ink-soft:   #514C40;
  --ink-faint:  #837A67;
  --walnut:     #6B4A34;
  --pine:       #2E4B3B;
  --pine-hover: #1F3A2C;
  --line:       #DBD1BB;
  --card:       #FFFFFF;
  --gold:       #A9832E;
  --silver:     #8A8A83;
  --bronze:     #9C6B3E;

  --serif: "Source Serif 4", Georgia, "Noto Serif TC", serif;
  --sans:  "Inter", "Noto Sans TC", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:  "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --max: 760px;
}

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

html {
  scroll-behavior: smooth;
  background: var(--paper);
  color-scheme: light;
  min-height: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

a { color: var(--pine); text-decoration-color: rgba(46,75,59,0.35); text-underline-offset: 3px; }
a:hover { color: var(--pine-hover); text-decoration-color: currentColor; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--pine);
  outline-offset: 2px;
}

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

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* ---------------- header ---------------- */

.site-header {
  position: relative;
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
  padding: 36px 0 30px;
}

/* faint goban (Go board) grid — the page's signature motif */
.goban {
  position: absolute;
  top: -40px;
  right: -60px;
  width: 380px;
  height: 380px;
  opacity: 0.14;
  pointer-events: none;
}
.goban line { stroke: var(--paper); stroke-width: 1; }
.goban circle { fill: var(--paper); }

.header-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "name    photo"
    "role    photo"
    "contact photo";
  align-items: start;
  column-gap: 24px;
  row-gap: 4px;
}

.h-name { grid-area: name; min-width: 0; }
.h-role { grid-area: role; min-width: 0; }
.h-photo { grid-area: photo; align-self: stretch; display: flex; }
.h-contact { grid-area: contact; }

.h-name h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.7rem, 4.6vw, 2.5rem);
  letter-spacing: 0.01em;
  line-height: 1.2;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 14px;
  white-space: nowrap;
}

.h-name h1 .zh-name {
  font-weight: 500;
  font-size: 0.68em;
  color: #C9C2AE;
}

.h-role {
  margin-top: 10px;
  font-size: 0.98rem;
  color: #D9D4C4;
  max-width: 46ch;
}

.h-role a { color: #EDE7D6; }

.h-photo img {
  width: 132px;
  height: 100%;
  min-height: 140px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.h-contact {
  position: relative;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(245,241,231,0.18);
  font-size: 0.9rem;
  color: #D9D4C4;
}
.contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 32px;
}
.contact-office {
  margin-top: 6px;
}
.contact-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}
.contact-office.contact-line {
  white-space: normal;
}
.h-contact dt {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9A937C;
  flex-shrink: 0;
}
.h-contact dd a { color: #EDE7D6; }

/* ---------------- nav ---------------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.site-nav .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 4px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.site-nav a {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.site-nav a:hover,
.site-nav a.active {
  background: var(--ink);
  color: var(--paper);
}
.lang-switch {
  margin-left: auto;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--paper);
  background: var(--pine);
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.lang-switch:hover { background: var(--pine-hover); }

/* ---------------- sections ---------------- */

main { padding-bottom: 40px; }

section {
  padding: 32px 0 12px;
  border-top: 1px solid var(--line);
}
section:first-of-type { border-top: none; }

.jump-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}
.jump-nav a {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 16px;
}
.jump-nav a:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

h3.sub-title {
  scroll-margin-top: 68px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.4rem;
  text-transform: none;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
  margin: 28px 0 10px;
}
h3.sub-title:first-child { margin-top: 0; }

/* lists */
ul.stone-list {
  list-style: none;
}
ul.stone-list > li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 12px;
}
ul.stone-list > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}

/* events */
#events li .when {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--walnut);
}

/* publications & projects: native ordered lists, restart per group */
ol.pub-list,
ol.proj-list {
  list-style: decimal;
  padding-left: 1.5em;
}
ol.pub-list li::marker,
ol.proj-list li::marker {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--walnut);
}
.pub-list li {
  padding: 12px 0 12px 6px;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
.pub-list li:last-child { border-bottom: none; }

.book-row {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.book-row img {
  width: 160px;
  border: 1px solid var(--line);
  border-radius: 3px;
  flex-shrink: 0;
}
.book-row .pub-list { flex: 1; min-width: 260px; }
.pub-list .year {
  font-family: var(--mono);
  color: var(--walnut);
  font-weight: 600;
  margin-right: 4px;
}
.pub-list .venue { font-style: italic; }
.pub-list .tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  background: var(--paper-2);
  color: var(--ink-soft);
  border-radius: 3px;
  padding: 1px 6px;
  margin-left: 4px;
}
.pub-list .best {
  color: var(--gold);
  font-weight: 700;
}


.proj-list li {
  padding: 10px 0 10px 6px;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
.proj-list li:last-child { border-bottom: none; }
.proj-list .year { font-family: var(--mono); color: var(--walnut); margin-right: 6px; }

.pub-links {
  margin-top: 16px;
  font-size: 0.88rem;
}

/* awards */
ul.award-list { list-style: none; }
ul.award-list > li {
  position: relative;
  padding: 10px 0 10px 22px;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
ul.award-list > li:last-child { border-bottom: none; }
ul.award-list > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
ul.award-list > li.gold::before   { background: var(--gold); }
ul.award-list > li.silver::before { background: var(--silver); }
ul.award-list > li.bronze::before { background: var(--bronze); }
ul.award-list > li.honor::before  { background: var(--pine); }

.award-list .year {
  font-family: var(--mono);
  color: var(--ink-faint);
  margin-right: 4px;
}
.award-list .cert-link {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.82rem;
}
.award-thumb {
  margin-top: 8px;
  max-width: 160px;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.medal-key {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin: 14px 0 18px;
}
.medal-key span { display: inline-flex; align-items: center; gap: 6px; }
.medal-key i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.medal-key .gold i { background: var(--gold); }
.medal-key .silver i { background: var(--silver); }
.medal-key .bronze i { background: var(--bronze); }
.medal-key .honor i { background: var(--pine); }

/* place a list item's figure(s) to the right of its text */
li.with-figure {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
}
li.with-figure .item-text {
  flex: 1;
  min-width: 220px;
}
li.with-figure .award-thumb,
li.with-figure .activity-thumbs {
  flex-shrink: 0;
  margin-top: 0;
}

/* activity thumbs */
.activity-thumbs {
  display: flex;
  gap: 12px;
}
.activity-thumbs img {
  width: 90px;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 3px;
}

/* footer */
footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 48px;
  font-size: 0.82rem;
  color: var(--ink-faint);
}

/* responsive */
@media (max-width: 600px) {
  .site-header { padding: 28px 0 22px; }
  .header-inner {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name name"
      "role photo";
    row-gap: 6px;
    column-gap: 14px;
  }
  .h-photo { align-self: start; margin-top: 0; }
  .h-role { margin-top: 0; }
  .h-photo img { width: 84px; height: 104px; min-height: 0; }
  .h-contact { grid-row: 3; grid-column: 1 / -1; margin-top: 14px; }
  .contact-line { white-space: normal; flex-wrap: wrap; }
  .goban { width: 240px; height: 240px; top: -30px; right: -80px; }
  .site-nav a { font-size: 0.82rem; padding: 5px 9px; }
}
