/* openletterhk.org — self-hosted font only, no third-party requests.
   Dancing Script © its authors, SIL Open Font License 1.1 — see /fonts/OFL.txt. */

@font-face {
  font-family: "Dancing Script";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/dancing-script-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Dancing Script";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/dancing-script-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #fbfaf7;
  --bg-raised: #ffffff;
  --ink: #1b1a17;
  --ink-soft: #55524b;
  --ink-faint: #6f6b62;
  --rule: #e3e0d8;
  --accent: #b3261e;
  --accent-ink: #ffffff;
  --focus: #1d4ed8;
  --ok: #1a7f37;
  --err: #b3261e;
  --serif: Charter, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --script: "Dancing Script", "Snell Roundhand", "Apple Chancery", "Segoe Script", "Lucida Handwriting", "Brush Script MT", "URW Chancery L", "Z003", cursive;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15140f;
    --bg-raised: #1d1c16;
    --ink: #ece9e1;
    --ink-soft: #b8b3a7;
    --ink-faint: #8c877c;
    --rule: #2e2c25;
    --accent: #e5533f;
    --accent-ink: #15140f;
    --focus: #7aa2ff;
    --ok: #4ade80;
    --err: #ff7b6b;
  }
}
:root[data-theme="dark"] {
  --bg: #15140f;
  --bg-raised: #1d1c16;
  --ink: #ece9e1;
  --ink-soft: #b8b3a7;
  --ink-faint: #8c877c;
  --rule: #2e2c25;
  --accent: #e5533f;
  --accent-ink: #15140f;
  --focus: #7aa2ff;
  --ok: #4ade80;
  --err: #ff7b6b;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
}

.page {
  max-width: 42rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 5rem) 16px clamp(3rem, 8vw, 6rem);
}

/* ── Masthead ─────────────────────────────────────────────────── */

.masthead { margin-bottom: clamp(2rem, 5vw, 3.5rem); }

.kicker {
  margin: 0 0 .75rem;
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.25rem, 7vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -.015em;
  text-wrap: balance;
}

.dateline {
  margin: 1.25rem 0 0;
  color: var(--ink-faint);
  font-size: .9375rem;
}

/* ── Letter ───────────────────────────────────────────────────── */

.letter {
  font-family: var(--serif);
  font-size: clamp(1.125rem, 1.05rem + .35vw, 1.25rem);
  line-height: 1.65;
}

.letter p { margin: 0 0 1.35em; }
.letter p:last-child { margin-bottom: 0; }

.refrain {
  margin: 2em 0;
  padding-left: 1.25rem;
  border-left: 3px solid var(--accent);
}
.refrain p { margin-bottom: 1em; }
.refrain p:last-child { margin-bottom: 0; }

/* ── Sections ─────────────────────────────────────────────────── */

.sign, .signatories, .colophon {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding-top: clamp(2rem, 5vw, 3rem);
  border-top: 1px solid var(--rule);
}

h2 {
  margin: 0 0 .5rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.75rem;
  line-height: 1.2;
}

.lede { margin: 0 0 1.5rem; color: var(--ink-soft); }

/* ── Form ─────────────────────────────────────────────────────── */

.choice {
  margin: 0 0 1.25rem;
  padding: 0;
  border: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
}
.choice legend {
  padding: 0;
  margin-bottom: .6rem;
  font-weight: 600;
}
.option {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  min-height: 44px;
}
.option input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: var(--accent);
}

.fields { display: grid; gap: 1rem; margin-bottom: 1.25rem; }
.fields[hidden] { display: none; }

.field label { display: block; margin-bottom: .35rem; font-weight: 600; }
.hint { font-weight: 400; color: var(--ink-faint); }

input[type="text"], input[type="url"] {
  width: 100%;
  min-height: 44px;
  padding: .6rem .8rem;
  font: inherit;
  color: var(--ink);
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 6px;
}
input::placeholder { color: var(--ink-faint); }

button {
  min-height: 44px;
  padding: .7rem 1.4rem;
  font: inherit;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .6; cursor: progress; }

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

.status { margin: 1rem 0 0; min-height: 1.5em; color: var(--ink-soft); }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }

/* Honeypot: off-screen, not display:none (some bots check that). */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ── Undersigned: a wall of signatures ───────────────────── */

.count { margin: 0 0 1.5rem; color: var(--ink-soft); }

.sig-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 1.1rem 2.25rem;
}
.sig-list li {
  display: inline-flex;
  flex-direction: column;
  max-width: 100%;
}
.sig-name {
  font-family: var(--script);
  font-weight: 500;
  font-size: clamp(1.6rem, 1.3rem + 1vw, 2rem);
  line-height: 1.15;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.sig-site {
  margin-top: .1rem;
  font-size: .8125rem;
  color: var(--ink-faint);
  overflow-wrap: anywhere;
}
.sig-site a { color: inherit; }

/* ── Colophon ─────────────────────────────────────────────────── */

.colophon { font-size: .9375rem; color: var(--ink-soft); }
.colophon p { margin: 0 0 .75rem; }
.colophon a { color: inherit; }

/* ── Inline links in the letter ───────────────────────────────── */

.letter a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: .15em;
  text-decoration-thickness: 1px;
}
.letter a:hover { text-decoration-thickness: 2px; }

.made { color: var(--ink-faint); }

/* ── Author signoff under the letter ──────────────────────────── */

.signoff { margin-top: 2.75em; }
.signoff p { margin: 0; }
.signoff-name {
  font-family: var(--script);
  font-weight: 500;
  font-size: clamp(2rem, 1.6rem + 1.5vw, 2.75rem);
  line-height: 1.1;
}
.signoff-name a { text-decoration: none; }
.signoff-name a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.signoff-role {
  margin-top: .4rem !important;
  font-family: var(--sans);
  font-size: .9375rem;
  color: var(--ink-soft);
}

/* ── Share ────────────────────────────────────────────────────── */

.share {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding-top: clamp(2rem, 5vw, 3rem);
  border-top: 1px solid var(--rule);
}
.share-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}
.share-list li[hidden] { display: none; }
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 44px;
  padding: .55rem .95rem;
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
}
.share-btn:hover { border-color: var(--ink-faint); filter: none; }
.share-btn-primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.share-btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.ico { width: 1.15rem; height: 1.15rem; flex: none; fill: currentColor; }
.ico-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#share-status { margin-top: .9rem; }
