/*
 * Favaellar — one stylesheet for every page.
 *
 * Two axes the visitor controls: theme and language. Both are stamped on
 * <html> as data attributes by a tiny script in each page's <head>, before
 * first paint, so nothing flashes the wrong way round.
 *
 *   data-theme = light | dark
 *   data-lang  = en | zh
 *
 * The accent is a warm orange. It began as cinnabar, which was too brown; it
 * spent a version as jade, which was too far from what the practice feels
 * like. This is the warmth of the first without the mud: an orange that stays
 * orange, rather than sliding into brick on a pale ground.
 *
 * Both values are contrast-checked against the surfaces they sit on, in both
 * themes, for the button fill AND for the accent used as text — the pressed
 * language button uses it that way, and that is the reading that fails first.
 */

:root {
  /* Light is the base; the dark block below redefines only the tokens. */
  --ground:    #F3F2F0;
  --raised:    #FAFAF9;
  --sunk:      #EAE9E5;
  --ink:       #191817;
  --body:      #45433F;
  --quiet:     #78756F;
  --hair:      #DEDCD7;
  --hair-lit:  #C9C6BF;
  --accent:     #AF4E17;
  --accent-soft:#FBEDE4;
  --on-accent:  #FFF8F4;

  --shell:  74rem;
  --gutter: clamp(1.5rem, 5vw, 4.5rem);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ground:    #131211;
  --raised:    #1C1A18;
  --sunk:      #0E0D0C;
  --ink:       #EFEFEC;
  --body:      #B9B8B3;
  --quiet:     #85837D;
  --hair:      #2C2A27;
  --hair-lit:  #3D3A36;
  --accent:     #E08050;
  --accent-soft:#2A1A11;
  --on-accent:  #150A04;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--ground);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--body);
  font-family: Spectral, "Iowan Old Style", Georgia, serif;
  font-size: 1.0625rem;
  font-weight: 300;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* ── language ───────────────────────────────────────────── */

/*
 * Both languages sit in the DOM and one is hidden. It doubles the markup on a
 * four-page site, which is cheap, and it buys two things worth more than that:
 * the page still reads with JavaScript off, and switching is instant with no
 * fetch and no flash of the wrong language.
 */
:root[data-lang="en"] [lang="zh"] { display: none; }
:root[data-lang="zh"] [lang="en"] { display: none; }

:root[data-lang="zh"] body,
[lang="zh"] {
  font-family: "Noto Serif SC", Spectral, Georgia, serif;
}
:root[data-lang="zh"] body { line-height: 1.9; font-weight: 400; }
/* Chinese has no italic tradition; a slanted CJK face is a browser synthesising
   one badly. */
:root[data-lang="zh"] .standfirst { font-style: normal; }

.cjk { font-family: "Noto Serif SC", Spectral, serif; }

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

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

h1, h2, h3 { font-weight: 400; color: var(--ink); margin: 0; text-wrap: balance; }
p { margin: 0 0 1.15rem; }
p:last-child { margin-bottom: 0; }

.label {
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--quiet);
  margin: 0 0 1.4rem;
}
:root[data-lang="zh"] .label { letter-spacing: 0.14em; }

/* ── navigation ─────────────────────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--ground);
  border-bottom: 1px solid var(--hair);
}
.nav .shell { display: flex; align-items: center; gap: 1.25rem; min-height: 4.25rem; }

.brand {
  font-size: 1.16rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
}
.brand .cjk { font-size: 0.92rem; color: var(--quiet); }

.nav-links { display: flex; gap: 1.6rem; }
.nav-links a {
  font-size: 0.95rem;
  color: var(--body);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

.nav .btn { padding: 0.5rem 1.1rem; font-size: 0.9rem; }

/* ── the two controls ───────────────────────────────────── */

.controls { display: flex; align-items: center; gap: 0.5rem; }

.seg {
  display: inline-flex;
  border: 1px solid var(--hair-lit);
  border-radius: 2px;
  overflow: hidden;
}
.seg button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--quiet);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--hair-lit); }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

.icon-btn {
  appearance: none;
  border: 1px solid var(--hair-lit);
  border-radius: 2px;
  background: transparent;
  color: var(--quiet);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  white-space: nowrap;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink); }

@media (max-width: 62rem) { .nav-links { display: none; } }
@media (max-width: 30rem) { .nav .btn { display: none; } }

/* ── buttons ────────────────────────────────────────────── */

.btn {
  display: inline-block;
  padding: 0.85rem 1.85rem;
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
  font-size: 1rem;
  letter-spacing: 0.02em;
  border-radius: 2px;
  white-space: nowrap;
  transition: opacity 0.15s ease;
}
.btn:hover, .btn:focus-visible { opacity: 0.88; }

.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--hair-lit); }
.btn-ghost:hover { border-color: var(--ink); opacity: 1; }

/* ── hero ───────────────────────────────────────────────── */

.hero { border-bottom: 1px solid var(--hair); }
.hero .shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  padding-top: clamp(3.5rem, 10vh, 6.5rem);
  padding-bottom: clamp(3.5rem, 10vh, 6.5rem);
}

.glyphs {
  font-family: "Noto Serif SC", serif;
  font-size: clamp(3.2rem, 8vw, 5.4rem);
  line-height: 1;
  color: var(--ink);
  letter-spacing: 0.06em;
  margin: 0 0 1.4rem;
}
.wordmark { font-size: clamp(1.5rem, 3.4vw, 2rem); letter-spacing: 0.02em; margin: 0 0 0.8rem; }
.standfirst {
  font-size: clamp(1.08rem, 1.9vw, 1.3rem);
  font-style: italic;
  line-height: 1.55;
  margin: 0 0 2rem;
  max-width: 32rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.hero-note { display: block; margin-top: 1rem; font-size: 0.9rem; color: var(--quiet); }

.hero-figure { display: grid; place-items: center; }
.luopan { width: min(100%, 26rem); height: auto; color: var(--ink); opacity: 0.16; }
:root[data-theme="dark"] .luopan { opacity: 0.22; }

@media (max-width: 52rem) {
  .hero .shell { grid-template-columns: 1fr; }
  .hero-figure { display: none; }
}

/* ── section scaffolding ────────────────────────────────── */

section { padding: clamp(3.25rem, 8vh, 5.5rem) 0; scroll-margin-top: 4.5rem; }
.band-raised { background: var(--raised); border-block: 1px solid var(--hair); }
/* The one band that changes ground rather than tone, so the page has a middle
   rather than running evenly from top to bottom. */
.band-sunk { background: var(--sunk); border-block: 1px solid var(--hair); }

.sec-head { max-width: 34rem; margin-bottom: clamp(2rem, 4vw, 3rem); }
.sec-head h2 { font-size: clamp(1.6rem, 3.4vw, 2.15rem); line-height: 1.2; margin-bottom: 0.6rem; }
.sec-head p { color: var(--quiet); margin: 0; }

.prose { max-width: 36rem; }
.prose h2 { font-size: clamp(1.4rem, 2.8vw, 1.75rem); margin: 2.5rem 0 0.7rem; }
.prose h2:first-child { margin-top: 0; }

/* ── cards ──────────────────────────────────────────────── */

.services {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: clamp(1.5rem, 3vw, 2.5rem);
  align-items: stretch;
}
.card {
  background: var(--ground);
  border: 1px solid var(--hair);
  border-radius: 3px;
  padding: clamp(1.5rem, 3vw, 2.25rem);
  height: 100%;
}
.band-raised .card { background: var(--raised); }
.card h3 { font-size: 1.35rem; line-height: 1.3; margin-bottom: 0.3rem; }
.card h3 .cjk { color: var(--quiet); font-size: 0.78em; margin-left: 0.45em; }

.terms {
  margin: 0 0 1.1rem;
  font-size: 0.93rem;
  color: var(--quiet);
  font-variant-numeric: tabular-nums;
}
.terms b { color: var(--ink); font-weight: 500; }

.tiers {
  margin: 1.4rem 0 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--hair);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 1.5rem;
  font-size: 0.93rem;
  font-variant-numeric: tabular-nums;
}
.tiers dt { color: var(--body); }
.tiers dd { margin: 0; text-align: right; color: var(--ink); }

/* ── steps ──────────────────────────────────────────────── */

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: clamp(1.5rem, 3vw, 2.5rem);
  margin: 0 0 2.75rem;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 50%;
  font-size: 0.85rem;
  line-height: 1;
  color: var(--accent);
}
.steps h3 { font-size: 1.06rem; margin-bottom: 0.3rem; }
.steps p { margin: 0; font-size: 0.97rem; color: var(--quiet); }

.fineprint { margin-top: 1.5rem; font-size: 0.92rem; color: var(--quiet); max-width: 38rem; }

/* ── facts ──────────────────────────────────────────────── */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: clamp(1.5rem, 3vw, 2.5rem);
  margin: 0;
}
.facts dt {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--quiet);
  margin-bottom: 0.5rem;
}
.facts dd { margin: 0; }
.facts a, .prose a, .aside a {
  color: var(--ink);
  text-decoration-color: var(--hair-lit);
  text-underline-offset: 0.25em;
}
.facts a:hover, .prose a:hover, .aside a:hover { text-decoration-color: var(--accent); }

/* ── long-form layout ───────────────────────────────────── */

.with-aside {
  display: grid;
  grid-template-columns: minmax(0, 36rem) minmax(0, 16rem);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}
.aside {
  position: sticky;
  top: 6rem;
  border-top: 1px solid var(--hair);
  padding-top: 1.5rem;
  font-size: 0.94rem;
}
.aside dt {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--quiet);
  margin-bottom: 0.35rem;
}
.aside dd { margin: 0 0 1.4rem; color: var(--body); }
.aside dd:last-child { margin-bottom: 0; }

@media (max-width: 58rem) {
  .with-aside { grid-template-columns: 1fr; }
  .aside { position: static; max-width: 36rem; }
}

/* ── portrait & closing ─────────────────────────────────── */

.portrait {
  display: block;
  aspect-ratio: 1 / 1;
  width: min(100%, 20rem);
  height: auto;
  border: 1px solid var(--hair);
  border-radius: 3px;
  object-fit: cover;
  object-position: center 78%;
}

/* Placeholder state only — an <img> never matches this, so once every page
   has a real photo this rule is dead and can go. */
.portrait:not(img) {
  display: grid;
  place-items: center;
  background: var(--raised);
  color: var(--quiet);
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
  padding: 1rem;
}

.closing { display: grid; gap: 1.5rem; justify-items: start; max-width: 38rem; }
.seal {
  display: inline-grid;
  place-items: center;
  width: 3.1rem;
  height: 3.1rem;
  background: var(--accent);
  color: var(--on-accent);
  font-family: "Noto Serif SC", serif;
  font-size: 1.45rem;
  line-height: 1;
  border-radius: 2px;
}
.closing h2 { font-size: clamp(1.6rem, 3.4vw, 2.15rem); line-height: 1.2; }

/* ── footer ─────────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--hair);
  padding: 2.5rem 0 3.5rem;
  font-size: 0.86rem;
  color: var(--quiet);
}
.footer-row { display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; justify-content: space-between; }
footer a { color: var(--quiet); text-underline-offset: 0.25em; }
footer a:hover { color: var(--ink); }

/* ── legal pages ────────────────────────────────────────── */

.notice {
  border: 1px solid var(--hair-lit);
  border-left: 2px solid var(--accent);
  border-radius: 0 3px 3px 0;
  padding: 1rem 1.25rem;
  margin: 0 0 2.25rem;
  font-size: 0.93rem;
  color: var(--quiet);
  max-width: 36rem;
}
.notice strong { color: var(--ink); font-weight: 500; }
