/* NorthWood R66 — UI / typography polish for the public site.
   Loaded LAST on every public page (home ×3, guides, terms, 404), after nw-editorial.css.
   It only restyles. No route, script hook, data-* attribute, CMS slot, SEO markup (#nw-products, .nw-pcard,
   data-nw-needs-products, JSON-LD) or inline script is touched, so the CSP hashes in _headers stay valid.
   What it does:
   1. Chinese type: no fake italics on Chinese, line breaks at phrase boundaries, calmer line height,
      and the small mono labels are not tracked like Latin capitals.
   2. Readability floor: no visible text below 12px (labels were 10–11.5px).
   3. Shared rhythm: one focus ring, link underlines that clear descenders, anchored sections that stop below the fixed nav.
   4. Guides: crumbs line up with the article, quick-answer box loses its dead space, meta line gets separators,
      the featured card's empty area becomes a quiet plank pattern, the header order matches the home page,
      and the phone dock matches the home-page dock. */

/* ---------- 1. Chinese typography ---------- */
:lang(zh) :is(h1, h2, h3, h4, blockquote, q, cite, em, i, .quote, .visit p) { font-style: normal !important; }
:lang(zh) h1 em, :lang(zh) h1 em * { font-style: normal !important; }
/* home-page headlines (short) break after punctuation (，、。？) instead of inside a word; a phrase too long for the line still wraps.
   Long guide titles keep normal Chinese wrapping so their first line is never left nearly empty. */
:lang(zh) body:not(.g):not(.nw-doc) :is(h1, h2, h3) { word-break: keep-all; overflow-wrap: anywhere; line-break: strict; letter-spacing: 0 !important; }
:lang(zh) body { line-height: 1.75; }
:lang(zh) :is(p, li, dd, .g-article p) { line-break: strict; }
:lang(zh) :is(h2, h3) { line-height: 1.3 !important; }
:lang(zh) h1 { line-height: 1.14 !important; }
/* mono labels: CJK has no monospace face, so use the sans face and drop the capital-letter tracking */
:lang(zh) :is(.tag, .hero .tag, .sec .tag, .g-eyebrow, .b2b .tag, .coll-head > span, .mat .price, .hero-badges span, .qb-k, .qb-l,
  .fb-kicker, .wg-badge, .wg-card small, .nw-open, .states span, footer h4, .foot h4, dt, .bot, .bot-links a, .stars + *) span.tr,
:lang(zh) :is(.tag, .g-eyebrow, .hero-badges span, .wg-badge, dt, footer h4, .foot h4).tr {
  font-family: var(--sans) !important; letter-spacing: .02em !important; }

/* ---------- 2. readability floor ---------- */
html body :is(.tag, .hero .tag, .sec .tag, .b2b .tag, .g-eyebrow, .hero-badges span, .coll-head > span, .qb-k, .qb-l, .fb-kicker) { font-size: 12px !important; }
html body :is(.mat .price, .wg-badge, .states > span, dl > dt, footer h4, .bot, .bot-links a) { font-size: 12px !important; }
:lang(zh) body :is(.tag, .hero .tag, .sec .tag, .b2b .tag, .g-eyebrow, .hero-badges span, .coll-head > span, .qb-k, .qb-l, .fb-kicker,
  .mat .price, .wg-badge, .states > span, dl > dt, footer h4, .bot, .bot-links a) { font-size: 13px !important; }
/* brand line under the logo: 10px → 11px, still one line */
html body .brand small, html body .g-brand small { font-size: 11px !important; }

/* ---------- 3. shared rhythm ---------- */
:where(a, button, summary, [tabindex], input, select, textarea):focus-visible {
  outline: 2px solid var(--accent, #9c5318) !important; outline-offset: 3px !important; border-radius: 4px; }
:where(main, .g-article, footer, .sec) a:not([class]) { text-underline-offset: .22em; text-decoration-thickness: 1px; text-decoration-skip-ink: auto; }
:where(section[id], [id].sec, .g-article h2[id], .g-article [id]) { scroll-margin-top: 96px; }
:where(h1, h2, h3) { text-wrap: balance; }
:where(p, li, .g-article p, .g-answer p) { text-wrap: pretty; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
::selection { background: var(--accent-soft, rgba(201, 113, 47, .22)); color: inherit; }
/* numbers line up in every table, stat and price */
:where(table, .hero-stats, .trust, .score, .nw-open, .g-spec) { font-variant-numeric: tabular-nums; }

/* hero card: drop the empty strip under the opening-hours line (desktop) */
@media (min-width: 1024px) {
  html body .hero-side { align-self: start; }
  html body .hero-side .nw-open { margin-bottom: 0 !important; padding-bottom: 14px !important; }
}

/* ---------- 4. guides ---------- */
/* crumbs share the article's column instead of the page's wider column */
@media (min-width: 900px) { .g-wrap > .g-crumbs:has(+ .g-article) { max-width: 760px; margin-left: auto; margin-right: auto; } }
.g-answer > :last-child { margin-bottom: 0 !important; }
.g-answer { padding-bottom: 22px !important; }
.g-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 0 !important; }
@media (min-width: 600px) { .g-meta > * + *::before { content: "·"; margin: 0 .6em; color: var(--mute); } }
@media (max-width: 599px) { .g-meta { column-gap: 14px !important; } }
/* header: theme switch before the language menu, exactly like the home page */
.g-tools .theme-toggle { order: -1; }
/* featured guide card: content sits at the foot, the space above becomes a quiet floor-plank pattern */
@media (min-width: 761px) {
  .g-grid > .g-card:first-child { display: flex !important; flex-direction: column; justify-content: flex-end; position: relative; overflow: hidden; }
  .g-grid > .g-card:first-child::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 52%; pointer-events: none;
    background: var(--hair-2);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='88'%3E%3Cpath d='M0 .5H240M0 44.5H240M.5 0V44M120.5 44V88' stroke='%23000' fill='none'/%3E%3C/svg%3E") 0 0 / 240px 88px repeat, linear-gradient(180deg, #000 20%, transparent);
    -webkit-mask-composite: source-in;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='88'%3E%3Cpath d='M0 .5H240M0 44.5H240M.5 0V44M120.5 44V88' stroke='%23000' fill='none'/%3E%3C/svg%3E") 0 0 / 240px 88px repeat intersect, linear-gradient(180deg, #000 20%, transparent); }
  .g-grid > .g-card:first-child > * { position: relative; }
  .g-grid > .g-card:first-child > em { margin-top: 22px !important; }
}
/* phone dock on guide pages = the home-page dock (floating, rounded, ink primary with a green status dot) */
@media (max-width: 760px) {
  html body .g-dock { left: max(10px, env(safe-area-inset-left)) !important; right: max(10px, env(safe-area-inset-right)) !important;
    bottom: max(10px, env(safe-area-inset-bottom)) !important; max-width: 560px; margin-inline: auto; padding: 6px !important; gap: 6px !important;
    border-radius: 14px !important; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 6px 24px rgba(0, 0, 0, .12); }
  html body .g-dock a { min-height: 48px; border-radius: 8px !important; font: 600 14px/1 var(--sans) !important; gap: 8px; display: flex !important; align-items: center; justify-content: center; }
  html body .g-dock .wa { background: var(--ink-0) !important; color: var(--paper) !important; }
  html body .g-dock .wa::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--live, #2f8a57); box-shadow: 0 0 0 3px rgba(47, 138, 87, .25); }
  html body .g-dock .call { background: transparent !important; color: var(--ink-0) !important; }
  body.g { padding-bottom: 84px; }
}

/* ---------- 5. small screens ---------- */
@media (max-width: 760px) {
  /* hero trust chips wrap onto two tidy lines instead of running under the dock */
  html body .hero-badges { row-gap: 6px !important; }
  html body .hero-badges span { padding-right: 10px !important; margin-right: 10px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
@media print { .g-grid > .g-card:first-child::before { display: none; } }

/* ---------- 6. remaining small labels (found by the R66 audit) ---------- */
html body .mats .mat .price { font-size: 12px !important; }
:lang(zh) body .mats .mat .price { font-size: 13px !important; }
html body .logo small { font-size: 11px !important; letter-spacing: .08em !important; }
html body .rev-wrap .rv > span[style] { font-size: 12px !important; }
html body .g-brand small { font-size: 11px !important; }
/* "book a sample" links in the colour collections: a 32px tall tap area (was 20px) without moving the text */
html body .coll-ask { display: inline-flex !important; align-items: center; min-height: 32px; }

/* R66 any device: phones held sideways (short screens). The hero no longer starts with ~110px of empty space
   under the slim top bar, and the floating dock sits lower and slimmer so the headline is readable */
@media (orientation: landscape) and (max-height: 500px) {
  html body .hero { padding-top: 76px !important; min-height: auto !important; }
  html body .nw-dock { bottom: max(6px, env(safe-area-inset-bottom)) !important; }
  html body .nw-dock a { min-height: 36px !important; }
  html body .hero h1 { font-size: clamp(34px, 12vh, 56px) !important; }
  html body .hero-owner { margin-bottom: 18px !important; }
}
