/* ==========================================================================
   SIGHAN — shared stylesheet
   Used by the SIGHAN organisation site (/) and SIGHAN-DCLP (/dclp/).
   Set data-site="dclp" on <html> to switch to the workshop accent palette.
   ========================================================================== */

/* ---- Tokens ------------------------------------------------------------ */

:root {
  --paper:        #fbfaf7;
  --paper-raised: #ffffff;
  --paper-sunken: #f3f0ea;
  --ink:          #161b23;
  --ink-soft:     #3d4652;
  --ink-muted:    #6b7480;
  --rule:         #e4ded4;
  --rule-strong:  #d2cabb;

  --accent:       #a8322b;   /* cinnabar / seal red */
  --accent-deep:  #7d221d;
  --accent-wash:  #fbeeec;

  --jade:         #2f6b5e;
  --jade-wash:    #e9f2ef;

  --amber:        #8a6414;
  --amber-wash:   #fbf1da;

  /* Chinese headings fall back to a Song face where one is installed, otherwise
     to the system sans (YaHei on Windows) rather than SimSun. */
  --font-display: "Source Serif 4", "Iowan Old Style", Georgia, "Songti SC",
                  "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC",
                  "PingFang SC", "Microsoft YaHei", serif;
  --font-body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
                  "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --font-mono:    ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --wrap:  1080px;
  --wrap-narrow: 760px;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(22, 27, 35, .05), 0 8px 24px -12px rgba(22, 27, 35, .16);
}

:root[data-site="dclp"] {
  --accent:      #23695c;
  --accent-deep: #17493f;
  --accent-wash: #e8f2ef;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:        #14171c;
    --paper-raised: #1b1f26;
    --paper-sunken: #1f242c;
    --ink:          #eceef1;
    --ink-soft:     #c2c8d1;
    --ink-muted:    #939ba7;
    --rule:         #2b313a;
    --rule-strong:  #3a424e;

    --accent:      #e88a80;
    --accent-deep: #f0a79e;
    --accent-wash: #2c1f1e;

    --jade:        #6fc0ae;
    --jade-wash:   #172824;

    --amber:       #d6ad5c;
    --amber-wash:  #2a2317;

    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .7);
  }
  :root[data-site="dclp"] {
    --accent:      #6fc0ae;
    --accent-deep: #8fd3c3;
    --accent-wash: #172824;
  }
}

/* ---- Reset / base ------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-deep); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 .5em;
  letter-spacing: -.01em;
}
h1, h2, h3 { text-wrap: balance; }   /* no lone last word — or lone 字 — on a line */
h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.02rem; font-family: var(--font-body); font-weight: 650; }

p  { margin: 0 0 1.1em; }
ul, ol { margin: 0 0 1.1em; padding-left: 1.25em; }
li { margin-bottom: .35em; }

hr { border: 0; border-top: 1px solid var(--rule); margin: 3rem 0; }

code { font-family: var(--font-mono); font-size: .9em; background: var(--paper-sunken);
       padding: .12em .35em; border-radius: 4px; }

.wrap        { max-width: var(--wrap); margin: 0 auto; padding: 0 1.5rem; }
.wrap-narrow { max-width: var(--wrap-narrow); margin: 0 auto; padding: 0 1.5rem; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

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

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-header__inner {
  max-width: var(--wrap); margin: 0 auto; padding: .7rem 1.5rem;
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
/* The official SIGHAN logo already contains the wordmark, so pages using it
   drop .brand__name and pair the image with the subtitle alone. */
.brand__logo { display: block; flex: none; height: 46px; width: auto; }
.brand > .brand__sub { align-self: center; white-space: nowrap; }

.brand__text  { display: flex; flex-direction: column; }
.brand__name  { font-family: var(--font-display); font-weight: 600; font-size: 1.06rem; letter-spacing: .01em; }
.brand__sub   { font-size: .72rem; color: var(--ink-muted); letter-spacing: .04em; text-transform: uppercase; }

.nav { margin-left: auto; display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.nav a {
  color: var(--ink-soft); text-decoration: none; font-size: .93rem;
  padding: .38rem .5rem; border-radius: 6px;
}
.nav a:hover { color: var(--ink); background: var(--paper-sunken); }
.nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.nav .nav__cta {
  background: var(--accent); color: #fff; font-weight: 550; padding: .4rem .8rem;
}
.nav .nav__cta:hover { background: var(--accent-deep); color: #fff; }
@media (prefers-color-scheme: dark) { .nav .nav__cta { color: #14171c; } .nav .nav__cta:hover { color: #14171c; } }

@media (max-width: 420px) {
  /* The workshop tagline repeats the page heading; dropping it on phones keeps
     the language switch on the logo row. */
  .brand > .brand__sub, .brand__text .brand__sub { display: none; }
}

/* ---- Language switch ----------------------------------------------------
   Every page carries three languages as sibling <span>s inside one shared
   element, so layout rules keep applying: lang="en", lang="zh-Hans"
   (Simplified) and lang="zh-Hant" (Traditional, generated by tools/hant.py).
   Only the language that <html lang> names is shown. assets/js/lang.js sets
   <html lang>; without JavaScript the page stays English. Do not use lang
   attributes for anything else (such as tagging a Chinese word inside English
   text): they would be hidden too. */

html:not([lang="en"]) body [lang="en"]:not([data-set-lang]),
html:not([lang="zh-Hans"]) body [lang="zh-Hans"]:not([data-set-lang]),
html:not([lang="zh-Hant"]) body [lang="zh-Hant"]:not([data-set-lang]) { display: none !important; }

/* Traditional text gets Traditional-Chinese faces, which draw some shared
   characters differently from the Simplified-Chinese ones. */
html[lang="zh-Hant"] {
  --font-display: "Source Serif 4", "Iowan Old Style", Georgia, "Songti TC",
                  "Noto Serif TC", "Noto Serif CJK TC", "Source Han Serif TC",
                  "PingFang TC", "Microsoft JhengHei", serif;
  --font-body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
                  "PingFang TC", "Noto Sans CJK TC", "Microsoft JhengHei", sans-serif;
}

/* Above phone width the header stays one row — logo, nav, switch — and the nav
   links wrap inside their own box when space runs short. */
@media (min-width: 701px) {
  .site-header__inner { flex-wrap: nowrap; gap: 1rem; }
  .nav { justify-content: flex-end; }
}

.lang-switch {
  display: none; flex: none; padding: 2px;
  border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--paper-raised);
}
html.js .lang-switch { display: inline-flex; }
.lang-switch button {
  font: inherit; font-size: .82rem; font-weight: 600; line-height: 1;
  padding: .38rem .5rem; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink-muted); cursor: pointer;
}
.lang-switch button:hover { color: var(--ink); }
.lang-switch button[aria-pressed="true"] { background: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .lang-switch button[aria-pressed="true"] { color: #14171c; } }

/* Chinese reads better a little looser, and without the tight Latin tracking. */
html[lang|="zh"] body { line-height: 1.75; }
html[lang|="zh"] :is(h1, h2, h3) { letter-spacing: .01em; line-height: 1.3; }
html[lang|="zh"] .hero__lede { line-height: 1.7; }

@media (max-width: 700px) {
  /* A sticky header eats too much of a phone viewport once the nav wraps. */
  .site-header { position: static; }
  .site-header__inner { padding: .65rem 1.25rem .5rem; gap: .5rem .75rem; }
  .nav { margin-left: 0; width: 100%; gap: .15rem; order: 2; }
  .nav a { font-size: .88rem; padding: .32rem .5rem; }
  .lang-switch { order: 1; margin-left: auto; }   /* stays on the logo row */
  .lang-switch button { padding: .36rem .45rem; }
  .brand { min-width: 0; }
  .brand__logo { height: 38px; }
  html { scroll-padding-top: 1rem; }
}

/* ---- Hero -------------------------------------------------------------- */

.hero { padding: 4.5rem 0 3rem; border-bottom: 1px solid var(--rule); }
.hero--tight { padding: 3rem 0 2rem; }
.hero__eyebrow {
  font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); font-weight: 650; margin-bottom: .9rem;
}
.hero__lede { font-size: 1.2rem; color: var(--ink-soft); max-width: 62ch; }
.hero__meta {
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin-top: 1.5rem;
  font-size: .95rem; color: var(--ink-muted);
}
.hero__meta strong { color: var(--ink); font-weight: 600; }

/* ---- Sections ---------------------------------------------------------- */

.section { padding: 3.25rem 0; }
.section + .section { border-top: 1px solid var(--rule); }
.section__head { margin-bottom: 2rem; }
.section__head p { color: var(--ink-soft); max-width: 68ch; margin-bottom: 0; }
.eyebrow {
  font-size: .75rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-muted); font-weight: 650; margin-bottom: .6rem;
}

/* ---- Cards / grids ----------------------------------------------------- */

.grid { display: grid; gap: 1.1rem; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 900px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

.card {
  background: var(--paper-raised); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 1.4rem;
}
.card h3 { margin-bottom: .4rem; }
.card p:last-child { margin-bottom: 0; }
.card__num {
  font-family: var(--font-display); font-size: .85rem; color: var(--accent);
  font-weight: 650; letter-spacing: .08em; margin-bottom: .5rem;
}
a.card { display: block; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--accent); transform: translateY(-2px); color: inherit; }
a.card .card__go { color: var(--accent); font-size: .9rem; font-weight: 550; }

/* ---- Callouts ---------------------------------------------------------- */

.callout {
  border: 1px solid var(--rule-strong); border-left: 3px solid var(--accent);
  background: var(--paper-raised);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.15rem 1.35rem; margin: 1.75rem 0;
}
.callout > :last-child { margin-bottom: 0; }
.callout__title { font-weight: 650; margin-bottom: .35rem; display: block; }
.callout--status { border-left-color: var(--amber); background: var(--amber-wash); }
.callout--status .callout__title { color: var(--amber); }
.callout--note   { border-left-color: var(--jade); background: var(--jade-wash); }
.callout--note .callout__title { color: var(--jade); }

/* ---- Badges ------------------------------------------------------------ */

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .74rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
  padding: .22rem .55rem; border-radius: 999px;
  background: var(--accent-wash); color: var(--accent-deep);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}
.badge--amber { background: var(--amber-wash); color: var(--amber);
                border-color: color-mix(in srgb, var(--amber) 32%, transparent); }
.badge--jade  { background: var(--jade-wash); color: var(--jade);
                border-color: color-mix(in srgb, var(--jade) 32%, transparent); }
.badge--quiet { background: var(--paper-sunken); color: var(--ink-muted); border-color: var(--rule); }
@media (prefers-color-scheme: dark) { .badge { color: var(--accent); } }

/* ---- Buttons ----------------------------------------------------------- */

.btn-row { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.75rem; }
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .95rem; font-weight: 550; text-decoration: none;
  padding: .6rem 1.1rem; border-radius: 8px; border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-deep); color: #fff; }
.btn--ghost { border-color: var(--rule-strong); color: var(--ink); background: var(--paper-raised); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
@media (prefers-color-scheme: dark) {
  .btn--primary { color: #14171c; } .btn--primary:hover { color: #14171c; }
}

/* ---- Editions table (workshop archive) --------------------------------- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 1.5rem; }
table { border-collapse: collapse; width: 100%; min-width: 640px; font-size: .95rem; }
thead th {
  text-align: left; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-muted); font-weight: 650; padding: .6rem .8rem;
  border-bottom: 1px solid var(--rule-strong); white-space: nowrap;
}
tbody td { padding: .8rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
tbody tr:hover { background: var(--paper-sunken); }
td.year { font-family: var(--font-display); font-weight: 600; white-space: nowrap; }
td .ed-name { font-weight: 600; display: block; }
td .ed-venue { color: var(--ink-muted); font-size: .88rem; }
.links-inline { display: flex; flex-wrap: wrap; gap: .35rem .8rem; font-size: .88rem; }

/* ---- Timeline / editions list (mobile-friendly alt) -------------------- */

.editions { list-style: none; padding: 0; margin: 0; }
.editions > li {
  display: grid; grid-template-columns: 5.5rem 1fr; gap: 1.25rem;
  padding: 1.1rem 0; border-bottom: 1px solid var(--rule); margin: 0;
}
.editions > li:last-child { border-bottom: 0; }
.editions .ed-year {
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 600;
  color: var(--accent); padding-top: .05rem;
}
.editions .ed-body h3 { font-size: 1.05rem; margin-bottom: .2rem; }
.editions .ed-body p  { margin-bottom: .5rem; color: var(--ink-muted); font-size: .92rem; }
@media (max-width: 560px) {
  .editions > li { grid-template-columns: 1fr; gap: .35rem; }
}

/* ---- People ------------------------------------------------------------ */

.people { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.person { background: var(--paper-raised); border: 1px solid var(--rule);
          border-radius: var(--radius); padding: 1.35rem; }
.person h3 { margin-bottom: .15rem; font-size: 1.1rem; }
.person .affil { color: var(--ink-muted); font-size: .92rem; margin-bottom: .55rem; }
.person .roles { margin-bottom: .7rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.person p { font-size: .93rem; color: var(--ink-soft); margin-bottom: .7rem; }
.person .contact { font-size: .86rem; color: var(--ink-muted); font-family: var(--font-mono); }

.pc-list {
  columns: 3 220px; column-gap: 2rem; list-style: none; padding: 0;
  font-size: .93rem;
}
.pc-list li { break-inside: avoid; margin-bottom: .5rem; padding-left: .9rem; position: relative; }
.pc-list li::before { content: "·"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.pc-list .pc-affil { color: var(--ink-muted); display: block; font-size: .85rem; }

/* ---- Definition-style key dates ---------------------------------------- */

.dates { list-style: none; padding: 0; margin: 0; }
.dates li {
  display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
  padding: .8rem 0; border-bottom: 1px solid var(--rule); margin: 0;
}
.dates li:last-child { border-bottom: 0; }
.dates .d-label { font-weight: 550; }
.dates .d-value { color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* ---- Footer ------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--rule); background: var(--paper-sunken);
  padding: 3rem 0 2.5rem; margin-top: 3rem; font-size: .92rem;
}
.site-footer .cols { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.site-footer h4 { font-size: .76rem; letter-spacing: .1em; text-transform: uppercase;
                  color: var(--ink-muted); margin-bottom: .8rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .45rem; }
.site-footer a { color: var(--ink-soft); text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
.site-footer .colophon {
  margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule);
  color: var(--ink-muted); font-size: .86rem;
}
.site-footer .colophon p { margin-bottom: .4rem; }

/* ---- Prose page -------------------------------------------------------- */

.prose h2 { margin-top: 2.5rem; }
.prose h3 { margin-top: 1.75rem; }
.prose > :first-child { margin-top: 0; }

.ext::after { content: " ↗"; font-size: .82em; color: var(--ink-muted); }

@media print {
  .site-header, .site-footer, .btn-row { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
}
