/* GrainHour legal pages: privacy, terms, support (English and Chinese).
   Same paper and ink as the homepage (/en/); one readable column.
   Fonts are linked from each page: EB Garamond (English, and the wordmark), Noto Sans TC (Chinese). */

:root {
  --paper: #f3f3f0;
  --ink: #15181b;
  --muted: #5b6167;   /* secondary text: 5.6:1 on paper */
  --hair: #cfd4d7;    /* rules */
  --line: #9aa1a7;    /* resting link underline */
  --qing: #4e737a;    /* draft markers only (the homepage accent) */
  --en: "EB Garamond", Georgia, "Times New Roman", serif;
  --zh: "Noto Sans TC", "PingFang TC", "Heiti TC", "Microsoft JhengHei", sans-serif;
  --sans: "Noto Sans TC", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--en);
  font-size: 20px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.zh { font-family: var(--zh); font-size: 16.5px; line-height: 1.9; letter-spacing: 0.02em; }
::selection { background: #dce3e5; }

a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-decoration-thickness: 1px; text-underline-offset: 3px; overflow-wrap: anywhere; }
a:hover { text-decoration-color: currentColor; }
a:focus-visible, summary:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }

/* ---------- header: • GrainHour on the left, the other language on the right ---------- */
.top {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: calc(env(safe-area-inset-top, 0px) + 22px) clamp(16px, 4vw, 52px) 0;
}
.mark { display: inline-flex; align-items: center; gap: 9px; font-family: var(--en); font-size: 22px; letter-spacing: 0.01em; text-decoration: none; }
.mark i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; display: block; transform: translateY(-1px); }
.lang { text-decoration: none; font-size: 16px; }
.lang:lang(zh) { font-family: var(--zh); font-size: 15px; letter-spacing: 0.08em; }
.lang:lang(en) { font-family: var(--en); font-size: 17px; letter-spacing: 0; }

/* ---------- the column ---------- */
.doc { max-width: 70ch; margin: 0 auto; padding: clamp(44px, 9vh, 96px) clamp(16px, 4vw, 32px) clamp(56px, 10vh, 112px); }

.kicker { margin: 0 0 10px; font-size: 17px; font-style: italic; color: var(--muted); }
body.zh .kicker { font-style: normal; font-size: 13.5px; letter-spacing: 0.12em; }
body.zh .kicker span { font-family: var(--en); font-size: 15px; letter-spacing: 0.02em; }

h1, h2, h3 { font-weight: 500; text-wrap: balance; scroll-margin-top: 24px; }
h1 { margin: 0 0 14px; font-size: clamp(36px, 5.2vw, 50px); line-height: 1.08; letter-spacing: -0.005em; }
h2 { margin: 2.6em 0 0.7em; padding-top: 1em; border-top: 1px solid var(--hair); font-size: 27px; line-height: 1.25; }
h3 { margin: 1.9em 0 0.45em; font-size: 21px; font-weight: 600; line-height: 1.3; }
body.zh h1 { font-size: clamp(28px, 4.2vw, 36px); line-height: 1.3; letter-spacing: 0.08em; }
body.zh h2 { font-size: 20px; letter-spacing: 0.06em; line-height: 1.5; }
body.zh h3 { font-size: 17.5px; font-weight: 500; letter-spacing: 0.04em; line-height: 1.6; }
/* Chinese headings and questions break at punctuation, not mid-phrase (fall back to anywhere if a line has none) */
body.zh h1, body.zh h2, body.zh h3, body.zh summary { word-break: keep-all; overflow-wrap: anywhere; }

p, ul { margin: 0 0 1em; }
ul { padding-left: 1.15em; }
li { margin: 0.4em 0; padding-left: 0.15em; }
li::marker { color: var(--muted); }
strong { font-weight: 600; }
body.zh strong { font-weight: 700; }

.meta { margin: 0 0 6px; color: var(--muted); font-size: 0.9em; }
.note { margin: 18px 0 2.4em; padding: 2px 0 2px 14px; border-left: 2px solid var(--hair); color: var(--muted); font-size: 0.86em; }
.note strong { color: var(--ink); font-weight: 500; }

/* support page */
.lede { font-size: 1.2em; line-height: 1.45; margin: 0 0 22px; }
body.zh .lede { font-size: 1.12em; line-height: 1.8; }
.contact { margin: 0 0 6px; }
.email { font-size: clamp(25px, 6vw, 36px); line-height: 1.2; text-decoration-color: var(--ink); }
body.zh .email { font-family: var(--en); letter-spacing: 0; }
.callout { margin: 2em 0; padding: 2px 0 2px 14px; border-left: 2px solid var(--ink); }
details { border-top: 1px solid var(--hair); padding: 14px 0; }
details:last-of-type { border-bottom: 1px solid var(--hair); }
summary { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; cursor: pointer; list-style: none; font-weight: 500; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; flex: none; color: var(--muted); font-weight: 400; }
details[open] summary::after { content: "\2212"; }
details > p { margin: 10px 0 4px; }
.who { margin-top: 3em; color: var(--muted); font-size: 0.9em; }

/* draft-only: anything still waiting on a decision. Remove the class (or the whole mark) before publishing. */
mark.ph { background: none; color: inherit; text-decoration: underline dashed var(--qing); text-decoration-thickness: 1px; text-underline-offset: 4px; }
mark.ph::after {
  content: attr(data-ph);
  display: inline-block; margin-left: 0.5em; padding: 0 6px 1px;
  font: 500 11px/1.5 var(--sans); letter-spacing: 0.06em; color: var(--qing);
  border: 1px solid var(--qing); border-radius: 2px; vertical-align: 0.2em;
}

/* ---------- footer: © and the three pages + the other language ---------- */
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 14px 32px;
  padding: 36px clamp(16px, 4vw, 52px) calc(env(safe-area-inset-bottom, 0px) + 32px);
  border-top: 1px solid var(--hair);
  color: var(--muted); font-size: 16px;
}
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.foot a { color: var(--ink); text-decoration: none; }
.foot a:hover, .foot a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--line); }
body.zh .foot { font-size: 13.5px; letter-spacing: 0.08em; }
body.zh .foot a:lang(en) { font-family: var(--en); font-size: 16px; letter-spacing: 0; }
.foot a:lang(zh) { font-family: var(--zh); font-size: 14px; letter-spacing: 0.08em; }

@media (max-width: 560px) {
  body { font-size: 19px; }
  body.zh { font-size: 16px; }
  h2 { font-size: 24px; }
  body.zh h2 { font-size: 19px; }
  .doc { padding-top: 40px; }
}

@media print {
  .top, .foot { display: none; }
  body { background: #fff; font-size: 12pt; }
  .doc { max-width: none; padding: 0; }
  details { break-inside: avoid; }
}
