/* ==========================================================================
   LONGSTAY — reading layout + inline discovery cards  (additive layer)
   --------------------------------------------------------------------------
   Loaded AFTER style.css. Two responsibilities, both non-destructive:

   1. Layout + typography: widen the centred column on roomy screens so the
      two side gutters stop dominating, and lift the reading text a little.
      Line width, leading, paragraph rhythm and alignment are normalised
      across the long-form text so the pages feel deliberately typeset.

   2. Small "discovery card" bands placed inline at natural pauses in each
      page's content. Ordinary in-flow blocks — they scroll with the page and
      never float over or shift original content.

   Everything is scoped to .er-* or explicit reading selectors. Remove this
   one <link> to roll the whole layer back. No HTML / content is touched.
   ========================================================================== */

/* ---- 1. LAYOUT WIDTH --------------------------------------------------- */
/* The original --wrap is a hard 1280px, which leaves ~320px of empty space on
   each side of a 1920px screen. Let the column grow with the viewport up to a
   readable ceiling, while keeping the comfortable 1280px on smaller desktops
   and the existing gut on mobile. min() guards against overflow at any size. */
@media (min-width: 1121px) {
  :root {
    --wrap: min(1520px, calc(100vw - 96px));
  }
}

/* ---- 2. TYPOGRAPHY ----------------------------------------------------- */
/* One coherent reading rhythm, applied only where text is actually read.
   Micro labels, the device mock and dense data tables keep original sizing. */
@media (min-width: 1121px) {
  body { font-size: 16px; line-height: 1.62; }

  /* lead copy: one size, one measure, one leading */
  .lede, .phead .lede, .stage-sub, .art-lede {
    font-size: 17px;
    line-height: 1.7;
    max-width: 68ch;
  }
  .phead .lede { max-width: 70ch; }
  .sec-sub {
    font-size: 15.5px; line-height: 1.72;
    max-width: 72ch; margin-bottom: 30px;
  }
  .small { font-size: 13.5px; line-height: 1.66; }
  .hero-note { font-size: 12.5px; line-height: 1.62; }

  /* running prose: consistent body size, leading and paragraph rhythm */
  .prose { max-width: 78ch; }
  .prose p, .prose li {
    font-size: 15.5px;
    line-height: 1.8;
  }
  .prose p { margin-bottom: 16px; }
  .prose p:last-child { margin-bottom: 0; }
  .prose h2 { font-size: 24px; }
  .prose h3 { font-size: 17.5px; }

  .note-card p { font-size: 14.5px; line-height: 1.74; }
  .chg-b p { font-size: 13.5px; line-height: 1.7; }
  .tip, .feedback { font-size: 13px; line-height: 1.7; }

  .feature-body > p:not(.art-lede),
  .short-body > p { font-size: 15.5px; line-height: 1.82; }
  .figcaption,
  .feature-fig figcaption,
  .short-fig figcaption { font-size: 12.5px; }

  /* data rows: readable but still compact */
  .row-v { font-size: 14.5px; }
  .row-v .sub { font-size: 12.5px; }
  .gcard li { font-size: 13px; }
  .kv .k2 { font-size: 12px; }

  /* heading tiers — proportional steps, display headlines stay authored */
  .h-sec { font-size: clamp(25px, 2.6vw, 38px); }
  .phead h1 { font-size: clamp(36px, 4.2vw, 64px); }
  .grp-t { font-size: 18px; }
  .art-title { font-size: clamp(28px, 3.2vw, 45px); }
  .art-title.sm { font-size: clamp(22px, 2.3vw, 29px); }

  /* alignment: body copy is flush-left (matches CJK + Latin reading);
     long measures are capped, never justified. */
  .prose, .lede, .sec-sub, .art-lede, .feature-body, .short-body {
    text-align: left;
    hyphens: auto;
  }
}

/* Chinese copy: keep the roomier CJK leading, lift size to match English. */
@media (min-width: 1121px) {
  html[lang="zh-Hans"] .prose p,
  html[lang="zh-Hans"] .prose li  { font-size: 15.5px; line-height: 1.95; }
  html[lang="zh-Hans"] .lede,
  html[lang="zh-Hans"] .phead .lede,
  html[lang="zh-Hans"] .stage-sub { line-height: 1.85; hyphens: none; }
  html[lang="zh-Hans"] .art-lede  { font-size: 17px; line-height: 1.9; }
  html[lang="zh-Hans"] .row-v     { font-size: 14.5px; }
  html[lang="zh-Hans"] .h-sec     { font-size: clamp(24px, 2.5vw, 34px); }
}

/* Compact screens: a small lift only, preserving the original tight layout. */
@media (max-width: 1120px) and (min-width: 621px) {
  body { font-size: 15.5px; line-height: 1.6; }
  .prose p, .prose li { font-size: 15px; line-height: 1.78; }
}

/* ---- 3. INLINE DISCOVERY CARDS ---------------------------------------- */
.er-band {
  max-width: var(--wrap);
  margin: 30px auto;
  padding: 0 var(--gut);
}
.er-band:empty { display: none; }
.er-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(228px, 1fr));
  gap: 14px;
  align-items: stretch;
}
.er-card {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 17px 18px;
  min-height: 122px;
}
.er-k {
  display: flex;
  align-items: center;
  gap: 7px;
  font: 600 9px/1.3 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--blue-3);
  margin-bottom: 11px;
}
.er-k::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--blue-3);
  flex: none;
}
.er-fact { font-size: 13px; line-height: 1.66; color: var(--fg-2); min-height: 66px; }
.er-dots { display: flex; gap: 6px; margin-top: 11px; }
.er-dot {
  width: 6px; height: 6px; padding: 0;
  border: 0; border-radius: 99px;
  background: var(--line-3);
  cursor: pointer;
  transition: width .2s ease, background .2s ease;
}
.er-dot.on { width: 15px; background: var(--blue-3); }

.er-pulse { display: grid; gap: 8px; }
.er-pulse .big {
  font: 700 27px/1 var(--display);
  letter-spacing: -.04em;
  color: #fff;
}
.er-pulse .big small {
  font: 500 10px/1.4 var(--mono);
  color: var(--muted);
  margin-left: 5px;
}
.er-pulse .line {
  font-size: 11.5px; line-height: 1.45; color: var(--muted);
  padding-top: 7px; border-top: 1px solid var(--line);
}
.er-pulse .line b { color: var(--fg-2); font-weight: 600; }

.er-tip { font-size: 13px; line-height: 1.66; color: var(--fg-2); }
.er-tip b { color: var(--fg); font-weight: 600; }
.er-links { display: grid; }
.er-links a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 0; font-size: 12px; color: var(--fg-2);
  border-top: 1px solid var(--line); transition: color .16s;
}
.er-links a:first-child { border-top: 0; padding-top: 1px; }
.er-links a:hover { color: var(--blue-3); }
.er-links a span { color: var(--muted-2); font-family: var(--mono); font-size: 13px; }

.er-x {
  position: absolute; top: 11px; right: 11px;
  width: 20px; height: 20px; display: grid; place-items: center;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--muted-2); font-size: 15px; line-height: 1; cursor: pointer;
}
.er-x:hover { color: var(--fg); background: rgba(255,255,255,.06); }

html[lang="zh-Hans"] .er-k { letter-spacing: .06em; text-transform: none; }
html[lang="zh-Hans"] .er-fact,
html[lang="zh-Hans"] .er-tip { line-height: 1.82; }

@media (max-width: 620px) {
  .er-band { margin: 22px auto; }
  .er-card { padding: 15px; min-height: 0; }
  .er-fact { min-height: 0; }
}
/* ---- 4. REGIONS AT A GLANCE (home "Browse by region" gap) ------------- */
.er-regions { margin-top: 22px; }
.er-regions-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.er-regions-head .er-k { margin-bottom: 0; }
.er-regions-sub { font-size: 12px; color: var(--muted-2); }
.er-regions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.er-region {
  display: flex; flex-direction: column; gap: 7px;
  min-height: 104px;
  padding: 14px 15px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--bg-2);
  transition: border-color .16s, background .16s, transform .16s;
}
.er-region:hover {
  border-color: var(--blue-3);
  background: var(--bg-3);
  transform: translateY(-2px);
}
.er-region-name {
  font-family: var(--display);
  font-size: 14px; font-weight: 600;
  letter-spacing: -.01em;
  color: var(--fg);
}
.er-region-bar { font-size: 12px; color: var(--muted); line-height: 1.4; }
.er-region-bar b { color: var(--ok); font-weight: 600; font-variant-numeric: tabular-nums; }
.er-region-foot {
  display: flex; align-items: center; gap: 4px;
  margin-top: auto;
  font-family: var(--mono);
  font-size: 9.5px; letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.er-region-foot b { color: var(--fg-2); font-weight: 600; }
.er-region-foot i { margin-left: auto; font-style: normal; color: var(--blue-3); font-size: 13px; }
html[lang="zh-Hans"] .er-region-name { font-size: 14.5px; }
html[lang="zh-Hans"] .er-region-foot { text-transform: none; letter-spacing: 0; }
@media (max-width: 620px) {
  .er-regions-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .er-region { padding: 12px; min-height: 96px; }
  .er-region-name { font-size: 13px; }
  .er-region-bar { font-size: 11px; }
}
@media print {
  .er-band, .er-regions { display: none !important; }
}
