/* ── Design tokens ─────────────────────────────── */
:root {
  --cream:  #F8F6F1;
  --white:  #FFFFFF;
  --ink:    #1A1A1E;
  --navy:   #1E2A4A;
  --navy2:  #2C3E6B;
  --red:    #C41E3A;
  --gold:   #B8963E;
  --green:  #2C6B3E;
  --muted:  #6B6B72;
  --border: #E0DAD0;

  --scale: 2;
}

/* ── Reset + base ──────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  line-height: 1.65;
}

/* ── Layout ────────────────────────────────────── */
.wrap { max-width: 860px; margin: 0 auto; padding: 0 1.5rem; }
section { padding: 3rem 0; }
.bg-white { background: var(--white); }
.bg-navy  { background: var(--navy); color: white; }
.bg-navy h2         { color: white; }
.bg-navy .sec-label { color: rgba(255,255,255,0.45); }
.bg-navy .sec-rule  { background: var(--gold); }

/* ── Section headings ──────────────────────────── */
.sec-label {
  font-size: 0.6rem; letter-spacing: 0.38em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.35rem; font-weight: 600;
}
h2 { font-size: clamp(1.8rem, 4vw, 2.5rem); color: var(--navy); margin-bottom: 0.4rem; }
.sec-rule { width: 36px; height: 3px; background: var(--red); margin-bottom: 2rem; }

/* ── Pinyin ────────────────────────────────────── */
.py        { display: none; color: var(--red); font-size: 0.8em; line-height: 1.3; }
.py-inline { display: none; color: var(--red); font-size: 0.78em; }
body.show-py .py        { display: block; }
body.show-py .py-inline { display: inline; }

/* ── English toggle ─────────────────────────────── */
.vm-zh  { display: none; }
.zh-alt { display: none; }
body.hide-en .en     { display: none; }
body.hide-en .vm     { display: none; }
body.hide-en .vm-zh  { display: block; }
body.hide-en .zh-alt { display: inline; }

/* ── Controls ──────────────────────────────────── */
#controls { position: fixed; top: 1rem; right: 1rem; z-index: 200; }
.btn-ctrl {
  background: var(--navy); color: white; border: none;
  padding: 0.45rem 1rem; border-radius: 20px; cursor: pointer;
  font-size: calc(0.8rem * var(--scale)); transition: background 0.18s;
}
.btn-ctrl:hover { background: var(--red); }

/* ── Vocab card ────────────────────────────────── */
.grid   { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); column-gap: 1.25rem; row-gap: 0.75rem; }
.grid-2 { grid-template-columns: 1fr 1fr; }

.vcard {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 10px; padding: 1.6rem;
  transition: box-shadow 0.18s;
  display: grid; grid-row: span 3; grid-template-rows: subgrid;
}
.vcard:hover { box-shadow: 0 4px 18px rgba(0,0,0,0.07); }
.vcard.t-red  { border-top: 3px solid var(--red); }
.vcard.t-navy { border-top: 3px solid var(--navy); }

.vhead    { grid-row: 1; }
.vmean    { grid-row: 2; align-self: end; }
.vcontent { grid-row: 3; }

.vh { font-size: calc(3rem * var(--scale)); font-weight: 300; color: var(--navy); line-height: 1; }
.vp { display: none; font-size: calc(1rem * var(--scale)); color: var(--red); margin-top: 0.25rem; }
body.show-py .vp { display: block; }
.vm    { font-size: calc(1.05rem * var(--scale)); font-weight: 600; }
.vm-zh { font-size: calc(1.05rem * var(--scale)); font-weight: 600; }

.vex {
  padding: 0.7rem 0.85rem;
  background: var(--cream); border-left: 3px solid var(--red); border-radius: 3px;
}
.vex .zh { font-size: calc(1rem * var(--scale)); font-weight: 500; line-height: 1.6; }
.vex .en { font-size: calc(0.88rem * var(--scale)); color: var(--muted); margin-top: 0.2rem; }
.vex-img { display: block; width: 100%; max-height: 130px; object-fit: cover; border-radius: 4px; margin-bottom: 0.55rem; }
.vex-img[src=""] { display: none; }

.vplay {
  display: inline-flex; align-items: center; gap: 0.3rem;
  margin-top: 0.55rem;
  background: white; border: 1px solid var(--border);
  border-radius: 20px; padding: 0.18rem 0.65rem;
  cursor: pointer; font-family: inherit;
  font-size: calc(0.72rem * var(--scale)); color: var(--navy);
  transition: all 0.15s;
}
.vplay:hover  { background: var(--navy); color: white; border-color: var(--navy); }
.vplay.playing { background: var(--red);  color: white; border-color: var(--red); }

details.vnote { margin-top: 0.6rem; border-top: 1px solid var(--border); }
details.vnote > summary { font-size: calc(0.75rem * var(--scale)); color: var(--muted); cursor: pointer; padding: 0.4rem 0; list-style: none; }
details.vnote > summary::before        { content: '+ cultural note'; }
details.vnote[open] > summary::before { content: '− cultural note'; }
body.hide-en details.vnote > summary::before        { content: '+ 文化注释'; }
body.hide-en details.vnote[open] > summary::before { content: '− 文化注释'; }
.vn { font-size: calc(0.88rem * var(--scale)); color: var(--muted); line-height: 1.6; padding-top: 0.35rem; }

/* ── Passage ───────────────────────────────────── */
.passage {
  background: white; border-radius: 12px;
  padding: 2.5rem; border: 1px solid var(--border);
  line-height: 2.2; font-size: calc(1.15rem * var(--scale));
}
.passage p { margin-bottom: 1.5rem; }
.passage p:last-child { margin-bottom: 0; }

.hl { border-bottom: 2px solid var(--red); position: relative; cursor: help; }
.hl::after {
  content: attr(data-t);
  display: none; position: absolute;
  bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  background: var(--navy); color: white;
  font-size: 0.72rem; padding: 0.25rem 0.55rem;
  border-radius: 4px; white-space: nowrap; z-index: 50;
}
.hl:hover::after { display: block; }

/* ── Cover ─────────────────────────────────────── */
.cover {
  background-color: var(--navy);
  background-image: repeating-linear-gradient(-45deg, transparent, transparent 18px,
    rgba(255,255,255,0.018) 18px, rgba(255,255,255,0.018) 19px);
  color: white; padding: 4rem 2rem 3.5rem; text-align: center;
  position: relative; overflow: hidden;
}
.cover-masthead { font-size: calc(0.62rem * var(--scale)); letter-spacing: 0.45em; text-transform: uppercase; color: var(--gold); margin-bottom: 2rem; font-weight: 600; }
.cover-suit  { width: 90px; margin: 0 auto 1.5rem; }
.cover-title { font-size: clamp(2.4rem, 8vw, 4rem); font-weight: 900; letter-spacing: -0.02em; line-height: 1; margin-bottom: 0.3rem; }
.cover-py    { font-size: 0.95rem; color: var(--gold); letter-spacing: 0.12em; }
.cover-sub   { font-size: calc(1rem * var(--scale)); color: rgba(255,255,255,0.6); margin-top: 0.75rem; font-style: italic; }
.cover-meta  { margin-top: 2.5rem; font-size: calc(0.62rem * var(--scale)); color: rgba(255,255,255,0.3); letter-spacing: 0.28em; text-transform: uppercase; }

/* ── Footer ────────────────────────────────────── */
footer { background: var(--ink); color: rgba(255,255,255,0.3); text-align: center; padding: 2rem 1rem; font-size: calc(0.7rem * var(--scale)); letter-spacing: 0.12em; }

/* ── Responsive ────────────────────────────────── */
@media (max-width: 620px) {
  .grid-2 { grid-template-columns: 1fr; }
}
