/* Visual direction C, "Viewfinder". Colours, type and spacing are custom
   properties; see DESIGN-REVIEW.md for the scales and the reasons. */
:root {
  color-scheme: light;
  --bg: #EEF1F4;
  --surface: #FFFFFF;
  --ink: #111418;
  --ink-2: #4A5260;
  --ink-3: #5B6472;
  --line: #C5CBD3;
  --muted: #E4E8ED;
  --accent: #D92D20;
  --link: #B42318;
  --link-hover: #7A1A12;

  --font-display: Manrope, "Manrope Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: Manrope, "Manrope Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Type scale: 13 / 14 / 16 / 18 / 20 / 24, then the fluid hero and count. */
  --fs-fine: 13px;
  --fs-small: 14px;
  --fs-body: 16px;
  --fs-h3: 18px;
  --fs-h2: 20px;

  /* Spacing scale, 4px base. */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 48px; --s9: 64px;

  --gutter: max(var(--s4), env(safe-area-inset-left), env(safe-area-inset-right));
  --radius-frame: 20px;
  --radius-card: 14px;
  --page: 1120px;
  --measure: 68ch;
  --corner: 28px;
  --corner-inset: 12px;
}

/* Simplified Chinese pages (/zh/). Manrope has no CJK
   glyphs, so text uses the system's Chinese fonts; no font is downloaded for
   it. The display face stays first for the wordmark, the count and other
   Latin figures in headings. */
:root:lang(zh-Hans) {
  --font-cjk: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-display: Manrope, "Manrope Fallback", var(--font-cjk);
  --font-body: var(--font-cjk);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: var(--s4); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.55;
  overflow-wrap: break-word;
}

h1, h2, h3, p, ul, dl, dd { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; }
p { text-wrap: pretty; }

/* Chinese: strict line breaking keeps punctuation and small kana-like marks
   off the start of a line; words are never broken inside Latin model names.
   The tight Latin tracking on headings does not suit CJK. */
:lang(zh-Hans) { line-break: strict; word-break: normal; }
:lang(zh-Hans) h1, :lang(zh-Hans) h2, :lang(zh-Hans) h3 { letter-spacing: 0; }
/* Headings and other short display lines break only at spaces and
   punctuation, so a balanced line never splits a word such as 快门次数. */
:lang(zh-Hans) :is(h1, h2, h3, .result-fun, .result-message) { word-break: keep-all; overflow-wrap: anywhere; }
:lang(zh-Hans) .hero h1 { line-height: 1.2; }

a { color: var(--link); text-underline-offset: 0.18em; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: absolute; left: -999px; top: var(--s2); z-index: 2;
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s4);
  background: var(--surface); border-radius: 8px;
}
.skip:focus { left: var(--s2); }

.site-header, main, .site-footer {
  max-width: var(--page); margin: 0 auto;
  padding-left: var(--gutter); padding-right: var(--gutter);
}

/* Header */
.site-header {
  padding-top: max(var(--s2), env(safe-area-inset-top)); padding-bottom: var(--s2);
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0 var(--s2);
}
.brand {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--ink); text-decoration: none;
  font-family: var(--font-display); font-size: 26px; line-height: 1; letter-spacing: -0.03em;
}
.brand:hover { color: var(--ink); }
.wm-r { font-weight: 700; }
.rec-dot { width: 0.28em; height: 0.28em; border-radius: 50%; background: var(--accent); margin: 0 0.1em 0.46em; flex: none; }
.wm-count { font-weight: 500; }
.site-header nav { display: flex; margin: 0 calc(-1 * var(--s2)) 0 auto; }
.site-header nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s2);
  font-size: var(--fs-small); font-weight: 500; color: var(--ink-2); text-decoration: none; white-space: nowrap;
}
.site-header nav a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.site-header nav a.nav-extra, .site-header nav a.nav-roomy { display: none; }

/* Language switch: "EN / 中文". The current language is plain text, the
   other one a link with a 44 px target. On narrow phones only the link shows. */
.lang-switch {
  display: flex; align-items: center; margin: 0 calc(-1 * var(--s2)) 0 var(--s2);
  font-size: var(--fs-small); font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.lang-switch a {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 var(--s2);
  color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-decoration-thickness: 2px;
}
.lang-switch a:hover { text-decoration-color: var(--accent); }
.lang-here, .lang-sep { display: none; }
.lang-here { padding: 0 var(--s2); color: var(--ink-2); }
.lang-sep { color: var(--ink-3); }

main { padding-top: var(--s4); padding-bottom: var(--s8); display: flex; flex-direction: column; gap: var(--s6); }

/* Hero */
.hero { display: flex; flex-direction: column; gap: var(--s3); align-items: center; text-align: center; }
.hero h1 {
  max-width: 760px;
  font-weight: 700; font-size: clamp(30px, 23px + 2.2vw, 50px); line-height: 1.08; letter-spacing: -0.02em;
}
.hero p { max-width: 36em; font-size: clamp(16px, 15px + 0.25vw, 18px); line-height: 1.5; color: var(--ink-2); text-wrap: balance; }

/* The frame: drop zone and result */
.frame {
  container-type: inline-size;
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-frame);
  padding: calc(var(--corner-inset) + var(--corner) + var(--s3)) var(--s4);
  min-height: 300px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s4);
  text-align: center;
  outline: 3px solid transparent; outline-offset: -3px;
  transition: outline-color .12s;
}
.frame.is-over { outline-color: var(--accent); }
.frame.has-result #drop-state { display: none; }

.corner {
  position: absolute; width: var(--corner); height: var(--corner);
  border: 0 solid var(--ink); pointer-events: none; transition: border-color .12s;
}
.corner.tl { top: var(--corner-inset); left: var(--corner-inset); border-top-width: 3px; border-left-width: 3px; }
.corner.tr { top: var(--corner-inset); right: var(--corner-inset); border-top-width: 3px; border-right-width: 3px; }
.corner.bl { bottom: var(--corner-inset); left: var(--corner-inset); border-bottom-width: 3px; border-left-width: 3px; }
.corner.br { bottom: var(--corner-inset); right: var(--corner-inset); border-bottom-width: 3px; border-right-width: 3px; }
.frame.is-locked .corner { border-color: var(--line); }
.frame.is-over .corner { border-color: var(--accent); }
/* Focus-lock: when the box is ticked, the four corners jump in a little,
   flash the accent colour and settle in ink, like a camera confirming focus.
   The global reduced-motion rule turns this off. */
.corner.tl { --dx: 1; --dy: 1; }
.corner.tr { --dx: -1; --dy: 1; }
.corner.bl { --dx: 1; --dy: -1; }
.corner.br { --dx: -1; --dy: -1; }
@keyframes af-lock {
  0%   { transform: translate(0, 0); border-color: var(--line); }
  35%  { transform: translate(calc(var(--dx) * 10px), calc(var(--dy) * 10px)); border-color: var(--accent); }
  60%  { transform: translate(calc(var(--dx) * -2px), calc(var(--dy) * -2px)); border-color: var(--accent); }
  80%  { transform: translate(0, 0); border-color: var(--accent); }
  100% { transform: translate(0, 0); border-color: var(--ink); }
}
.frame.is-arming .corner { animation: af-lock .6s cubic-bezier(.2, .8, .2, 1) both; }

.state { display: flex; flex-direction: column; align-items: center; gap: var(--s2); width: 100%; }
.frame-title { font-size: clamp(20px, 17px + 1vw, 24px); font-weight: 600; line-height: 1.2; }
.frame-hint { font-size: var(--fs-small); color: var(--ink-2); }
.frame.is-locked .frame-title { color: var(--ink-2); }
.if-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .if-hover { display: none; }
  .if-touch { display: inline; }
}

.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; min-width: 200px; max-width: 100%; margin-top: var(--s2); padding: 0 var(--s6);
  border: 1px solid var(--ink); border-radius: 999px;
  background: var(--ink); color: var(--surface);
  font: 600 var(--fs-body)/1.2 var(--font-body);
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background-color .12s, border-color .12s;
}
.button:hover { background: var(--ink-2); border-color: var(--ink-2); }
.button-quiet { margin-top: var(--s3); background: var(--surface); color: var(--ink); border-color: var(--line); font-weight: 500; }
.button-quiet:hover { background: var(--surface); border-color: var(--ink); }
#file:focus-visible + .button { outline: 3px solid var(--ink); outline-offset: 3px; }
.frame.is-locked .button, .frame.is-busy .button { background: var(--muted); border-color: var(--muted); color: var(--ink-2); }
.frame.is-locked .button { cursor: not-allowed; }
.frame.is-busy .button { cursor: progress; }

/* One reserved line under the button, so the three states never move it. */
.frame-status { min-height: 1.5em; font-size: var(--fs-small); line-height: 1.5; color: var(--ink-2); }
.when-locked { color: var(--ink); font-weight: 600; }
.frame:not(.is-locked) .when-locked,
.frame.is-locked .when-ready, .frame.is-busy .when-ready,
.frame:not(.is-busy) .when-busy { display: none; }

/* Result */
#result-body { width: 100%; display: flex; flex-direction: column; align-items: center; gap: var(--s2); }
#result-body > p { text-wrap: balance; }
.result-kicker { font-size: var(--fs-small); color: var(--ink-2); }
.result-count {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(44px, 14vw, 84px); line-height: 1; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
@supports (font-size: 1cqi) { .result-count { font-size: clamp(44px, 18cqi, 84px); } }
.result-fun { font-family: var(--font-display); font-weight: 600; font-size: clamp(17px, 16px + 0.4vw, 19px); line-height: 1.35; max-width: 26em; }
.result-rating { font-size: var(--fs-small); line-height: 1.5; color: var(--ink-2); max-width: 36em; }
.result-message { font-family: var(--font-display); font-weight: 600; font-size: clamp(18px, 16px + 0.6vw, 20px); line-height: 1.3; max-width: 28em; }
.result-meta { font-size: var(--fs-small); color: var(--ink-2); }
.result-details {
  width: 26em; max-width: 100%; margin-top: var(--s2);
  font-size: var(--fs-small); line-height: 1.4; text-align: left;
}
.result-details div {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s4);
  padding: var(--s2) 0; border-top: 1px solid var(--line);
}
.result-details div:last-child { border-bottom: 1px solid var(--line); }
.result-details dt { color: var(--ink-2); }
.result-details dd { font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.result-note { margin-top: var(--s1); font-size: var(--fs-small); line-height: 1.5; color: var(--ink-2); max-width: 40em; }
.result-count:empty, .result-message:empty, .result-meta:empty, .result-note:empty,
.result-kicker:empty, .result-details:empty, .result-fun:empty, .result-rating:empty,
.xc-verdict:empty, .xc-status:empty { display: none; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 var(--s3); max-width: 100%; }
a.button { text-decoration: none; }
a.button:not(.button-quiet), a.button:not(.button-quiet):hover { color: var(--surface); }
a.button-quiet, a.button-quiet:hover { color: var(--ink); }

/* The R5 mod note under an EOS R5 result. */
.result-mod {
  width: 34em; max-width: 100%; margin-top: var(--s4); padding: var(--s4);
  display: flex; flex-direction: column; align-items: center; gap: var(--s2);
  border: 1px solid var(--line); border-radius: var(--radius-card);
  font-size: var(--fs-small); line-height: 1.5; color: var(--ink-2);
}
.result-mod h3 { font-size: var(--fs-h3); font-weight: 600; line-height: 1.3; color: var(--ink); }
.result-mod p { text-wrap: balance; }
.result-mod .button { margin-top: var(--s1); }
.fine { font-size: var(--fs-fine); line-height: 1.5; }

/* Cross-check: compare with another tool. Fields are left-aligned inside the
   centred frame; every control is at least 44 px tall. */
.xc {
  width: 34em; max-width: 100%; padding-top: var(--s5); border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: var(--s3); text-align: left;
}
.xc h3 { font-size: var(--fs-h2); font-weight: 600; line-height: 1.25; }
.xc p { font-size: var(--fs-small); line-height: 1.55; color: var(--ink-2); }
.xc p.fine { font-size: var(--fs-fine); line-height: 1.5; }
.xc-fields { display: grid; grid-template-columns: 1fr; gap: var(--s3) var(--s4); }
.xc-field { display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.xc label, .xc .xc-label { font-size: var(--fs-small); font-weight: 600; line-height: 1.4; color: var(--ink); }
.xc input, .xc select, .xc textarea {
  width: 100%; min-height: 44px; padding: var(--s2) var(--s3);
  border: 1px solid var(--ink-3); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: var(--fs-body); line-height: 1.4;
}
.xc textarea { resize: vertical; }
.xc input[aria-invalid="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.xc .result-details { width: 100%; margin-top: 0; }
.xc .xc-verdict { font-weight: 600; color: var(--ink); }
.xc #xc-share { display: flex; flex-direction: column; gap: var(--s2); }
.xc .xc-preview { min-height: 15em; field-sizing: content; background: var(--bg); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--fs-fine); line-height: 1.5; white-space: pre-wrap; }
.xc .result-actions { justify-content: flex-start; }
.xc .xc-status { font-weight: 600; color: var(--ink); }
.xc #xc-close { align-self: flex-start; min-width: 0; }

/* Consent: a small, plain line right under the frame (no box). The whole
   label is the tap target, so it stays at least 44px tall. */
.consent { display: flex; justify-content: center; margin-top: calc(-1 * var(--s3)); }
.consent label {
  display: flex; gap: var(--s2); align-items: flex-start;
  max-width: 40em; min-height: 44px; padding: var(--s2) var(--s1);
  font-size: 13px; line-height: 20px; color: var(--ink-2);
  border-radius: 8px; cursor: pointer;
}
.consent input { width: 18px; height: 18px; flex: none; margin: 1px 0 0; accent-color: var(--ink); cursor: pointer; }
.consent.is-nudged label { color: var(--ink); box-shadow: 0 0 0 2px var(--accent); }

/* Ad slot: the height is reserved before any ad loads (320×100 on phones,
   728×90 from tablets up), so filling it cannot move the page.
   No ads run yet, so the reader page carries <body class="ads-off"> and the
   empty box is not shown. To bring it back, drop that class in homePage()
   of launch/seo-build.mjs and rebuild. */
.ads-off .ad-slot { display: none; }
.ad-slot {
  background: var(--surface); border-radius: var(--radius-card);
  min-height: 100px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  font-size: var(--fs-fine); letter-spacing: 0.04em; color: var(--ink-3);
}

/* Cards */
.steps { display: grid; grid-template-columns: 1fr; gap: var(--s4); }
.card { background: var(--surface); border-radius: var(--radius-card); padding: var(--s5); }
.steps .card { display: flex; flex-direction: column; gap: var(--s2); }
.step-n { font-family: var(--font-display); font-size: var(--fs-small); font-weight: 500; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.card h2 { font-weight: 600; font-size: var(--fs-h2); line-height: 1.25; }
.card h3 { font-weight: 600; font-size: var(--fs-h3); line-height: 1.3; }
.card p { font-size: var(--fs-small); line-height: 1.55; color: var(--ink-2); }
.prose { display: flex; flex-direction: column; gap: var(--s3); }
.prose p { max-width: var(--measure); font-size: 15px; line-height: 1.6; }
.prose p.fine { font-size: var(--fs-fine); line-height: 1.5; }

.model-list {
  padding: 0; list-style: none;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--s2) var(--s4);
  font-size: 15px; line-height: 1.4; white-space: nowrap;
}
.model-list small { display: block; font-size: var(--fs-fine); color: var(--ink-2); white-space: normal; }

/* Promotion card for the R5 mod (home page). */
.promo { align-items: flex-start; }
.promo-kicker { font-family: var(--font-display); font-size: var(--fs-small); font-weight: 500; line-height: 1; color: var(--accent); }
.card .promo-kicker { font-size: var(--fs-small); color: var(--accent); }
.promo .button { margin-top: var(--s1); }

/* Cameras and privacy sit side by side once there is room for two measures. */
.info { display: grid; gap: var(--s6); }

/* Footer */
.site-footer {
  padding-bottom: max(var(--s7), env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: var(--s3);
  font-size: var(--fs-fine); line-height: 1.5; color: var(--ink-3);
}
.site-footer::before { content: ""; border-top: 1px solid var(--line); }
.footer-links { padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 0 var(--s6); font-size: var(--fs-small); }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; }
.footer-fine { display: flex; flex-direction: column; gap: var(--s2); max-width: var(--measure); }

@media (min-width: 480px) {
  :root { --corner: 36px; --corner-inset: 16px; }
  .site-header nav a.nav-roomy { display: inline-flex; }
  .lang-here, .lang-sep { display: inline; }
  .lang-switch a { min-width: 0; }
  .xc-fields { grid-template-columns: 1fr 1fr; }
  .xc-wide { grid-column: 1 / -1; }
  .frame { padding-left: var(--s6); padding-right: var(--s6); }
}

/* The header holds the wordmark, the links and the language switch on one
   line: two links on phones, "How it works" from 480 px, "Privacy" from 600 px.
   The hidden ones stay reachable in the footer and by scrolling. */
@media (min-width: 600px) {
  .site-header nav a.nav-extra { display: inline-flex; }
}

@media (min-width: 768px) {
  :root { --gutter: max(var(--s6), env(safe-area-inset-left), env(safe-area-inset-right)); --corner: 44px; --corner-inset: 20px; }
  .site-header { padding-top: max(var(--s3), env(safe-area-inset-top)); padding-bottom: var(--s3); }
  .site-header nav a { padding: 0 var(--s3); }
  .site-header nav { margin: 0 calc(-1 * var(--s3)) 0 auto; }
  .lang-switch { margin-left: var(--s4); }
  .brand { font-size: 28px; }
  main { gap: var(--s7); padding-bottom: var(--s9); }
  .info { gap: var(--s7); }
  .frame { min-height: 340px; padding-left: var(--s7); padding-right: var(--s7); }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .card { padding: var(--s6); }
  .ad-slot { min-height: 122px; }
  .site-footer { display: grid; grid-template-columns: 1fr auto; gap: var(--s3) var(--s7); align-items: start; }
  .site-footer::before { grid-column: 1 / -1; }
  .footer-links { order: 2; justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
