/* The page reads as a factory spec sheet: form cells ruled in gray over pattern-paper grid, with ticks and underlines
   in red pen. Every color, font and font size, and every margin, padding and gap, comes from the tokens
   below. */

@font-face {
  font-family: "Silky Serif";
  src: url("fonts/silky-serif-heavy.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}

:root {
  --paper: #FAFAF7;
  --grid: #E4E8EE;
  --line: #A7B0BC;
  --ink: #2E3239;
  --ink-2: #5F6670;
  --pen: #D0342C;

  --cjk-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC";
  --sans: var(--cjk-sans), sans-serif;
  --serif: "Silky Serif", "Songti SC", "STSong", "SimSun", serif;

  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-body: 16px;
  --fs-lg: 18px;
  --fs-claim: var(--fs-body);
  --fs-h2: 24px;
  --fs-h1: 44px;
  --fs-figure: 40px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --grid-step: 20px;
  --rule: 1px;
  --pen-stroke: 3px;
  --radius-button: 2px;
  --tap: 48px;
  --sheet-width: 1040px;
  --text-width: 36em;
  --qr-size: 200px;
  --col-name-width: 7.5em;
  --marquee-photo: 160px;
  --drift-per-photo: 6s;
  --rise-time: 600ms;
  --rise-step: 100ms;
}

@media (min-width: 760px) {
  :root {
    --fs-h2: 36px;
    --fs-h1: 88px;
    --fs-figure: 64px;
    --marquee-photo: 240px;
    --fs-claim: var(--fs-lg);
  }
}

@media (min-width: 1024px) {
  :root { --fs-figure: 72px; }
}

/* English letters and punctuation come from a Latin system font; the CJK fonts after it still draw the toggle's 中文. */
:root[lang="en"] { --sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, var(--cjk-sans), sans-serif; }

/* Both languages sit in the page and the script in <head> sets <html lang> from ?lang=zh. .zh and .en say on which
   page an element shows, not what language it is written in: the toggle's "EN" shows on the Chinese page. */
:root[lang="en"] .zh, :root:not([lang="en"]) .en { display: none; }

/* The script in <head> also sets <html data-type> from ?type=. An element with data-for shows only for the types it
   lists. */
:root[data-type="clothing"] [data-for]:not([data-for~="clothing"]),
:root[data-type="ceramics"] [data-for]:not([data-for~="ceramics"]),
:root[data-type="jewelry"] [data-for]:not([data-for~="jewelry"]) { display: none; }

* { box-sizing: border-box; }

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) var(--rule), transparent var(--rule)),
    linear-gradient(90deg, var(--grid) var(--rule), transparent var(--rule));
  background-size: var(--grid-step) var(--grid-step);
  color: var(--ink);
  font: 400 var(--fs-body)/1.7 var(--sans);
}

img { display: block; max-width: 100%; height: auto; }

a:focus-visible, .marquee:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.sheet {
  max-width: var(--sheet-width);
  margin: 0 auto;
  padding: var(--space-4) var(--space-4) var(--space-8);
  /* Below 320 px a price in the comparison table is wider than the screen; this keeps it from widening the page. */
  overflow-x: clip;
}

@media (min-width: 760px) {
  .sheet { padding: var(--space-7) var(--space-7) var(--space-8); }
}

h1, h2 {
  font-family: var(--serif);
  font-weight: 900;
  line-height: 1.25;
  margin: 0;
}

/* An English headline that wraps splits into even lines, so no short last word sits alone. The headline font is a CJK
   one, whose apostrophe is full width unless its proportional forms are asked for. */
:root[lang="en"] :is(h1, h2) { text-wrap: balance; font-variant-east-asian: proportional-width; }

/* Chinese breaks only at its punctuation and spaces, never inside a word. */
:root:not([lang="en"]) :is(h1, .compare-ways p, .matrix th, .matrix .val) { word-break: keep-all; }

h1 { margin-top: var(--space-6); font-size: var(--fs-h1); line-height: 1.05; }
h2 { font-size: var(--fs-h2); margin-bottom: var(--space-3); }

/* A pen line: the underlines and the ticks. */
.underline, .tick { fill: none; stroke: var(--pen); stroke-width: var(--pen-stroke); stroke-linecap: round; }

/* A small line icon in the text color, before a button's label or a channel's name. */
.icon { flex: none; width: var(--space-4); height: var(--space-4); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

p { margin: 0 0 var(--space-4); }

section p { max-width: var(--text-width); }

.compare-ways p { text-wrap: balance; }

section { margin-top: var(--space-8); }


/* A ruled box, the spec sheet's basic cell. */

.form, .picks, .cta, .compare, .ledger, .marquee, .channels {
  border: var(--rule) solid var(--line);
  background: var(--paper);
}

.form { display: flex; }

.form-head {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: 0 var(--space-3);
}

.form-head b { font-weight: 600; }

.logo { width: auto; height: var(--space-5); }

/* The email address and the language toggle (a link to the other language's page), each in its own small ruled
   cell at the right of the form cell. */
.mail-cell, .lang-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 var(--space-3);
  border-left: var(--rule) solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.lang-cell { font-weight: 600; }

@media (max-width: 759px) {
  .mail-cell { font-size: var(--fs-sm); }
}

/* The product type: one ruled cell, the question in a caption bar over a tile per type in equal thirds, the tiles
   sharing their rules. Each tile is a strip cut from a supplier's or maker's plain photo of that kind over a box and
   the type's name; the type on show is outlined in ink and its box ticked in pen. The photo sits inside the tile's
   padding, so the outline runs the same weight around the photo and the name. */
.picks { margin-top: var(--space-4); }

.picks-question {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-bottom: var(--rule) solid var(--line);
  font: 600 var(--fs-lg)/1.4 var(--sans);
}

.choices { display: flex; }

.pick {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2) var(--space-1);
  min-height: var(--tap);
  padding: var(--space-1) var(--space-1) var(--space-2);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.pick + .pick { border-left: var(--rule) solid var(--line); }
.pick:hover { background: var(--grid); }
/* The ink outline covers the gray rules around the tile, so none shows outside it. */
.pick[aria-current="page"] { position: relative; box-shadow: 0 0 0 var(--rule) var(--ink), inset 0 0 0 var(--rule) var(--ink); }
.pick img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; }

.box {
  position: relative;
  flex: none;
  width: var(--space-4);
  height: var(--space-4);
  border: var(--rule) solid var(--ink-2);
}

/* The tick overshoots its box, as a pen check does. */
.box .tick {
  position: absolute;
  left: calc(-1 * var(--space-1));
  bottom: 0;
  margin: 0;
  visibility: hidden;
}

.pick[aria-current="page"] .tick { visibility: visible; }

@media (min-width: 760px) {
  .pick { column-gap: var(--space-2); font-size: var(--fs-lg); }
  .pick img { aspect-ratio: 3 / 1; }
}

/* Before and after, side by side, then a row per detail: its name over a close-up from each photo. */

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.compare figure, .ledger figure { margin: 0; }
.compare figure:nth-of-type(2) { border-left: var(--rule) solid var(--line); }

.compare .zoom {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: var(--rule) solid var(--line);
}

.zoom figcaption { grid-column: 1 / -1; }
.zoom img + img { border-left: var(--rule) solid var(--line); }

.compare figcaption, .ledger figcaption {
  padding: var(--space-1) var(--space-2);
  border-bottom: var(--rule) solid var(--line);
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

.compare figcaption { display: flex; align-items: center; }

figcaption b { color: var(--ink); }

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 var(--space-5);
  border-radius: var(--radius-button);
  background: var(--pen);
  color: var(--paper);
  font: 600 var(--fs-lg)/1 var(--sans);
  text-decoration: none;
}

@media (min-width: 760px) {
  .button { display: inline-flex; }
}

/* The hero runs in one column at every width: the headline, the figures that back it, the ask, then the ledger. */

/* The figures: no box, an ink rule over the three, each number over its finding, the finding's key phrase underlined
   in pen, then its source. They stack on a phone and sit side by side from 760 px, where a subgrid keeps each number,
   finding and source on one row across the three. */
.figures { list-style: none; margin: var(--space-5) 0 0; padding: 0; border-top: var(--rule) solid var(--ink); }
.figures li { padding: var(--space-4) 0 var(--space-5); border-bottom: var(--rule) solid var(--line); }
.figures p { margin: 0; }
.figures .num { display: block; font: 900 var(--fs-figure)/1 var(--serif); white-space: nowrap; }
/* "Up to" in the number's own face at half its size, so it reads as clearly as the number it qualifies. */
.figures .num small { display: block; margin-bottom: var(--space-1); font-size: calc(var(--fs-figure) / 2); }
.figures .finding { margin-top: var(--space-3); font-size: var(--fs-lg); line-height: 1.6; text-wrap: pretty; }
/* Chinese breaks between any two characters, so pretty wrapping can still leave two characters alone on a finding's
   last line; balance can't. */
:root:not([lang="en"]) .figures .finding { text-wrap: balance; }
.figures .source { margin-top: var(--space-2); color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.5; text-wrap: balance; }

.key { position: relative; white-space: nowrap; }

.underline {
  position: absolute;
  left: calc(-1 * var(--space-1));
  bottom: calc(-1 * var(--space-2));
  width: calc(100% + var(--space-2));
  height: var(--space-2);
  overflow: visible;
}

@media (min-width: 760px) {
  .figures {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto 1fr;
    border-bottom: var(--rule) solid var(--line);
  }
  .figures li { display: grid; grid-row: span 3; grid-template-rows: subgrid; padding: var(--space-5); border-bottom: 0; }
  .figures li:first-child { padding-left: 0; }
  .figures li:last-child { padding-right: 0; }
  .figures li + li { border-left: var(--rule) solid var(--line); }
  /* "Up to" makes the third number two lines tall; the other two sit on its baseline. */
  .figures .num { align-self: end; }
}

/* The ask: one ruled cell, what the photos do and cost over what to send, then the button, beside them from 1024 px,
   where the heading keeps two lines. The heading and what to send are balanced in both languages, so the Chinese
   never leaves one character alone on a line. */
.cta { margin-top: var(--space-6); padding: var(--space-5) var(--space-4); }
.cta h2 { margin-bottom: var(--space-2); text-wrap: balance; }
.cta p { max-width: var(--text-width); margin: 0 0 var(--space-4); text-wrap: balance; }

/* An envelope (an .icon) before the English button's label, so it says it opens an email. */
.button .icon { margin-right: var(--space-2); }

@media (min-width: 760px) {
  .cta { padding: var(--space-5); }
}

@media (min-width: 1024px) {
  .cta { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: var(--space-6); }
  .cta p { margin-bottom: 0; }
}

.ledger { margin-top: var(--space-6); }

/* On load, the content under the picker rises into place from the top down, so a new type's examples ease in while
   the top bar and the picker hold still. --order is each element's place in that sequence, top to bottom. */
header > h1 { --order: 0; }
.figures { --order: 1; }
.cta { --order: 2; }
.ledger { --order: 3; }
main > section { --order: 4; }

@media (prefers-reduced-motion: no-preference) {
  header > :is(h1, .figures, .cta, .ledger), main > section {
    animation: rise var(--rise-time) ease-out calc(var(--order) * var(--rise-step)) both;
  }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(var(--space-4)); }
}

/* The ledger: the two photos a supplier sends beside the set we make from them, every photo in a ruled cell of one
   size. The two stack in the first of five columns, each caption sits above its photos, and a subgrid keeps both
   captions on one row so the photos line up. Where the first column is too narrow for its whole caption (below
   1024 px) it shows the bold words only, and so does the second on a phone. */

.ledger {
  display: grid;
  grid-template-columns: 1fr 4fr;
  grid-template-rows: auto auto;
}

.ledger figure { display: grid; grid-row: span 2; grid-template-rows: subgrid; }
.ledger figure + figure { border-left: var(--rule) solid var(--line); }

@media (max-width: 1023px) {
  .ledger-send .more { display: none; }
}

@media (max-width: 759px) {
  .ledger .more { display: none; }
  .ledger figcaption { padding-inline: var(--space-1); font-size: var(--fs-xs); }
}

.ledger figcaption { text-wrap: balance; }

.ledger ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--rule);
  background: var(--line);
}

.ledger-make ul { grid-template-columns: repeat(4, 1fr); }

.ledger li { background: var(--paper); }

.ledger-send ul { grid-template-columns: 1fr; }

/* The sources differ by a few pixels from 3:4, so every photo is held to it and the ruled cells stay flush; a close-up
   is held to the 3:2 it was cut at. */
.compare img, .ledger img, .marquee img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.zoom img { aspect-ratio: 3 / 2; }

/* A ledger whose maker sends one photo. On a phone it takes three columns: the photo, two rows tall, then four shots
   cropped square. From 760 px it takes clothing's five-column footprint: the photo across two columns and both rows,
   the shots in three; a set of five has its main image (.tall) run both rows. */
.ledger.one-photo { grid-template-columns: 1fr 2fr; }
.one-photo .ledger-make ul { grid-template-columns: repeat(2, 1fr); }
.one-photo .ledger-make li:nth-child(n + 5) { display: none; }
.one-photo .ledger-make img { aspect-ratio: 1; }
.one-photo .ledger-send li { position: relative; }
.one-photo .ledger-send img { position: absolute; inset: 0; height: 100%; aspect-ratio: auto; }

@media (min-width: 760px) {
  .ledger.one-photo { grid-template-columns: 2fr 3fr; }
  .one-photo .ledger-make ul { grid-template-columns: repeat(3, 1fr); }
  .one-photo .ledger-make li:nth-child(n + 5) { display: block; }
  .one-photo .ledger-make img { aspect-ratio: 3 / 4; }
  .one-photo .ledger-send .more { display: inline; }
  .one-photo .tall { position: relative; grid-row: span 2; }
  .one-photo .tall img { position: absolute; inset: 0; height: 100%; aspect-ratio: auto; }
}

/* The comparison: one row per question, one column per way to get the images, Silky's first, in ink and ticked. On
   a phone or tablet each row stacks its three answers, each beside its column's name. */

.matrix {
  width: 100%;
  border-collapse: collapse;
}

.matrix caption {
  caption-side: bottom;
  padding-top: var(--space-2);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  text-align: left;
}

/* On one line the English caption runs past 80 characters, so it wraps to two even lines. */
:root[lang="en"] .matrix caption { max-width: var(--text-width); text-wrap: balance; }

.matrix th, .matrix td {
  padding: var(--space-3);
  border: var(--rule) solid var(--line);
  background: var(--paper);
  color: var(--ink-2);
  text-align: left;
  vertical-align: top;
}

.matrix thead th, .matrix td:first-of-type { color: var(--ink); font-weight: 600; }
.matrix tbody th { font-weight: 400; white-space: nowrap; }
.matrix strong { color: var(--pen); font-size: var(--fs-claim); font-weight: 800; line-height: 1; }

.matrix thead th:nth-child(2) { width: 26%; }
.matrix td { text-wrap: pretty; }

/* Silky's tick leads its cell, and a wrapped answer lines up under the text, not under the tick. */
.matrix td:first-of-type .val { display: flex; align-items: flex-start; gap: var(--space-1); }
.matrix .tick { flex: none; width: var(--space-4); height: var(--space-4); margin: var(--space-1) 0 0; }

.col-name { display: none; }

@media (max-width: 1023px) {
  .matrix { display: flex; flex-direction: column; }
  .matrix caption { order: 1; }
  .matrix thead { display: none; }
  .matrix tbody, .matrix tr { display: block; }
  .matrix tr { border: var(--rule) solid var(--line); }
  .matrix tr + tr { border-top: 0; }
  .matrix th, .matrix td { display: block; border: 0; }
  .matrix tbody th { padding-bottom: var(--space-1); color: var(--ink); font-weight: 600; white-space: normal; }
  .matrix td {
    display: grid;
    grid-template-columns: var(--col-name-width) 1fr;
    gap: var(--space-2);
    padding-top: 0;
    padding-bottom: var(--space-1);
  }
  .matrix td:last-child { padding-bottom: var(--space-3); }
  .col-name { display: block; color: var(--ink-2); font-weight: 400; }
}

/* Studio and lifestyle shots: each row drifts sideways without end, the lifestyle row the other way, and stops while
   keyboard focus is on it. A row lists its photos twice and each list moves left by its own width, so
   the second list lands where the first began and the loop has no seam. With reduced motion a row stands still and
   scrolls sideways by hand. */

.marquee {
  display: flex;
  overflow: hidden;
  margin-top: var(--space-4);
}

.marquee + .marquee { margin-top: var(--space-2); }

.marquee ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex: none;
  animation: drift calc(var(--photos) * var(--drift-per-photo)) linear infinite;
}

.marquee.reverse ul { animation-direction: reverse; }

.marquee:focus-visible ul { animation-play-state: paused; }

@keyframes drift {
  to { transform: translateX(-100%); }
}

.marquee li {
  position: relative;
  flex: none;
  width: var(--marquee-photo);
  border-right: var(--rule) solid var(--line);
}

/* On a lifestyle shot, the supplier's own photo pinned in the corner like a swatch. */
.marquee .inset {
  position: absolute;
  left: var(--space-2);
  bottom: var(--space-2);
  width: 32%;
  padding: var(--space-1);
  border: var(--rule) solid var(--line);
  background: var(--paper);
}

@media (prefers-reduced-motion: reduce) {
  .marquee { overflow-x: auto; scroll-snap-type: x mandatory; }
  .marquee ul { animation: none; }
  .marquee ul[aria-hidden] { display: none; }
  .marquee li { scroll-snap-align: start; }
}

/* Before-and-after pairs: one under the other on a phone, side by side from 760 px. */

.pairs {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

@media (min-width: 760px) {
  .pairs { grid-template-columns: 1fr 1fr; }
}

.tick {
  width: var(--space-5);
  height: var(--space-5);
  margin-left: auto;
  stroke-linejoin: round;
}

.defs { position: absolute; width: 0; height: 0; }

.nowrap { white-space: nowrap; }

/* Contact: the question and the line under it, over one ruled cell with a row per channel, the channel's name and
   icon left of its address or, for WeChat, its QR code. */
.contact > p { margin-bottom: var(--space-5); text-wrap: balance; }

/* A subgrid sizes the name column to its widest name, so "Instagram" never crowds its rule on a phone. The address
   column may shrink below its content on the narrowest phones: the QR code shrinks with it (the img rule's
   max-width), and the email breaks after its @. */
.channels { display: grid; grid-template-columns: max-content minmax(0, 1fr); max-width: var(--text-width); margin: 0; border-top: 0; }
/* Each row draws the line above it, so rows can be reordered without moving a border. */
.channels div { position: relative; display: grid; grid-column: span 2; grid-template-columns: subgrid; border-top: var(--rule) solid var(--line); }

/* The name sits level with the top of its row, as the comparison table's do, beside the tall QR too. */
.channels dt {
  display: grid;
  grid-template-columns: auto 1fr;
  align-content: start;
  align-items: center;
  column-gap: var(--space-2);
  padding: var(--space-3);
  border-right: var(--rule) solid var(--line);
  color: var(--ink-2);
}

.channels dd { margin: 0; padding: var(--space-3); }
/* A link's ::after covers its whole row, so tapping the channel's name opens it too. */
.channels a::after { content: ""; position: absolute; inset: 0; }
.channels a { color: var(--ink); font-weight: 600; text-decoration-color: var(--pen); text-decoration-thickness: 2px; text-underline-offset: var(--space-1); }
.channels img { width: var(--qr-size); margin-bottom: var(--space-2); }
.channels dd span { color: var(--ink-2); font-size: var(--fs-sm); }

/* The Chinese page leads with WeChat: the hero's Chinese button jumps here for the QR, and the hero's Chinese line
   names WeChat before email. */
:root:not([lang="en"]) .wechat { order: -1; }

