/* HanQuest — hanquest.com
   Palette comes from the object the flagship is named after: 明镜, a bronze
   mirror. Polished bronze on one face, verdigris patina on the other. The tone
   colours are reserved for hanzi and nothing else, so they keep their meaning. */

:root {
  --ground:   #E7EDE8;
  --panel:    #F4F7F3;
  --ink:      #1B2A2E;
  --ink-soft: #4A5F63;
  --bronze:   #8C6B3F;
  --patina:   #3E6B61;
  --rule:     #C6D2CB;

  --t1: #C1442E;  /* 第一声  cinnabar */
  --t2: #B9761A;  /* 第二声  amber    */
  --t3: #2F7D4F;  /* 第三声  jade     */
  --t4: #2C5D9B;  /* 第四声  azure    */
  --t0: #6B7A78;  /* 轻声    neutral  */

  --latin: Spectral, Georgia, "Times New Roman", serif;
  --cjk: "Noto Serif CJK SC", "Noto Serif SC", "Source Han Serif SC",
         "Songti SC", "STSong", SimSun, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground:   #16302C;
    --panel:    #1C3A35;
    --ink:      #E6EDE7;
    --ink-soft: #A8BCB6;
    --bronze:   #C9A165;
    --patina:   #86C3B4;
    --rule:     #2C4F49;

    --t1: #F0806A;
    --t2: #E0A64A;
    --t3: #78C98E;
    --t4: #85B6EA;
    --t0: #93A5A2;
  }
}

@font-face {
  font-family: Spectral; font-style: normal; font-weight: 300;
  font-display: swap; src: url(fonts/spectral-300.woff2) format("woff2");
}
@font-face {
  font-family: Spectral; font-style: normal; font-weight: 400;
  font-display: swap; src: url(fonts/spectral-400.woff2) format("woff2");
}
@font-face {
  font-family: Spectral; font-style: normal; font-weight: 600;
  font-display: swap; src: url(fonts/spectral-600.woff2) format("woff2");
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--latin);
  font-weight: 400;
  font-size: 1.125rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.shell { max-width: 58rem; margin: 0 auto; padding: 0 1.5rem; }
.prose { max-width: 34rem; }

/* ---------- masthead ---------- */

.masthead {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap;
  padding: 2rem 0 0;
}

.mark {
  font-weight: 600; font-size: 1.25rem; letter-spacing: 0.01em;
  color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: baseline; gap: 0.45rem;
}
.mark .han { font-family: var(--cjk); color: var(--t4); font-size: 1.4rem; }

.masthead nav { display: flex; gap: 1.5rem; }
.masthead nav a { color: var(--ink-soft); text-decoration: none; font-size: 0.95rem; }
.masthead nav a:hover, .masthead nav a:focus-visible { color: var(--ink); text-decoration: underline; }
.masthead nav a[aria-current="page"] { color: var(--ink); }

/* ---------- hero ---------- */

.hero { padding: clamp(3rem, 9vw, 6.5rem) 0 clamp(2.5rem, 6vw, 4rem); }

.sentence {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  gap: 0.15em 0.1em;
  margin: 0 0 1.75rem;
}

.w {
  appearance: none; background: none; border: 0; padding: 0.1em 0.12em 0.25em;
  margin: 0; font: inherit; color: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 0.15em;
  border-bottom: 2px solid transparent;
  border-radius: 2px;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.w:hover, .w:focus-visible { border-bottom-color: var(--bronze); background: var(--panel); }
.w:focus-visible { outline: 2px solid var(--patina); outline-offset: 2px; }
.w[aria-pressed="true"] { border-bottom-color: var(--bronze); background: var(--panel); }

.py {
  font-family: var(--latin); font-weight: 300;
  font-size: clamp(0.72rem, 1.7vw, 0.95rem);
  color: var(--ink-soft); line-height: 1; letter-spacing: 0.02em;
}
.hz {
  font-family: var(--cjk); font-weight: 400; line-height: 1.1;
  font-size: clamp(2.1rem, 8.5vw, 4.25rem);
}
.punc { font-family: var(--cjk); font-size: clamp(2.1rem, 8.5vw, 4.25rem);
        color: var(--ink-soft); align-self: flex-end; line-height: 1.1; }

.t1 { color: var(--t1); } .t2 { color: var(--t2); } .t3 { color: var(--t3); }
.t4 { color: var(--t4); } .t0 { color: var(--t0); }
.hz b { font-weight: inherit; }

#gloss {
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  font-weight: 300; color: var(--ink-soft);
  margin: 0; min-height: 2.6em; max-width: 30rem;
}
#gloss strong { font-weight: 600; color: var(--ink); }
.hint { font-size: 0.9rem; color: var(--ink-soft); margin: 0.75rem 0 0; }

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

section + section { margin-top: clamp(3rem, 7vw, 5rem); }

h2 {
  font-family: var(--latin); font-weight: 600;
  font-size: clamp(1.45rem, 3.4vw, 1.9rem);
  line-height: 1.25; margin: 0 0 1.25rem;
}
h2 .han { font-family: var(--cjk); }

h3 { font-weight: 600; font-size: 1.2rem; margin: 0 0 0.35rem; }
h3 .han { font-family: var(--cjk); color: var(--ink); margin-right: 0.4rem; }

p { margin: 0 0 1.1rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--patina); text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }

.lede { font-size: 1.28rem; font-weight: 300; line-height: 1.55; }

.aside {
  border-left: 3px solid var(--bronze);
  padding: 0.15rem 0 0.15rem 1.25rem;
  margin: 2rem 0 0; max-width: 32rem;
  color: var(--ink-soft); font-size: 1.02rem;
}
.aside .hz-inline { font-family: var(--cjk); }

/* ---------- the four acts: a real sequence, so it gets a real timeline ---------- */

.acts { list-style: none; margin: 1.5rem 0 0; padding: 0;
        display: grid; gap: 0; max-width: 40rem; }
.act {
  display: grid; grid-template-columns: 4.5rem 1fr; gap: 1.25rem;
  padding: 1rem 0; border-top: 1px solid var(--rule);
  align-items: baseline;
}
.act:last-child { border-bottom: 1px solid var(--rule); }
.act .era {
  font-family: var(--cjk); font-size: 1.75rem; color: var(--bronze);
  line-height: 1;
}
.act .what { margin: 0; }
.act .what em { font-style: normal; color: var(--ink-soft); display: block;
                font-size: 0.95rem; }

.counts { margin: 1.75rem 0 0; padding: 0; list-style: none;
          display: flex; flex-wrap: wrap; gap: 0.5rem 2rem;
          font-size: 0.98rem; color: var(--ink-soft); max-width: 40rem; }
.counts b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- the apps ---------- */

.apps { margin: 1.5rem 0 0; padding: 0; list-style: none; }
.apps li { padding: 1.5rem 0; border-top: 1px solid var(--rule); max-width: 40rem; }
.apps li:last-child { border-bottom: 1px solid var(--rule); }
.apps p { font-size: 1.02rem; color: var(--ink-soft); margin: 0; }

/* ---------- video ---------- */

.films { margin: 1.5rem 0 0; padding: 0; list-style: none;
         display: grid; gap: 1.5rem;
         grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); }
.frame { position: relative; padding-top: 56.25%; background: var(--panel);
         border: 1px solid var(--rule); }
.frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.films figcaption { font-size: 0.95rem; color: var(--ink-soft); margin-top: 0.5rem; }

/* ---------- footer ---------- */

footer {
  margin-top: clamp(4rem, 9vw, 7rem); padding: 2rem 0 3rem;
  border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; align-items: baseline;
  font-size: 0.95rem; color: var(--ink-soft);
}
footer a { color: var(--ink-soft); }
footer a:hover { color: var(--ink); }
footer .spacer { flex: 1 1 auto; }

/* ---------- legal pages ---------- */

.doc { padding: clamp(2.5rem, 6vw, 4rem) 0 0; }
.doc h1 { font-weight: 600; font-size: clamp(1.8rem, 4.5vw, 2.4rem);
          line-height: 1.2; margin: 0 0 0.5rem; }
.doc .updated { color: var(--ink-soft); font-size: 0.95rem; margin: 0 0 2.5rem; }
.doc h2 { font-size: 1.25rem; margin-top: 2.5rem; }
.doc ul { max-width: 34rem; padding-left: 1.2rem; }
.doc li { margin-bottom: 0.6rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
