/* =============================================================
   LONGEX — Type system
   -------------------------------------------------------------
   Loaded AFTER each page's inline <style>, so this file is
   authoritative for the type stack. Page CSS still wins wherever
   it declares a property on a more specific selector; this file
   only carries decisions that must be identical on every page.

   Display  Petrona      — wght 100..900, roman and italic
   Body     Inter Tight  — wght 400..600
   Mono     Azeret Mono  — wght 400..600  (labels, badges, metadata)

   The mono role is named for what the code actually does. It was
   documented as "data and measurement only", but an audit of every
   live usage found all but two setting letters, not figures:
   eyebrows, plan tiers, status pills, step ordinals, timestamps.
   Every real measurement on the site — 92, +10.000, R$ 2.990, 250+
   — is display-face Petrona with tnum, which is what section 4's
   selector list actually covers; not one entry there is mono.
   medicos.html:686 is the clearest case: the words stay mono and
   the number is pulled back out into Petrona. Mono is this site's
   label voice, and the face is chosen for that job. Anything that
   is a sentence belongs in --font-body: the footer copyright used
   to sit here and was moved out.
   ============================================================= */

/* -------------------------------------------------------------
   1. Metric-matched fallbacks
   All three webfonts load with display=swap, so first paint uses a
   system face and then reflows. Measured against real glyph
   advances: Georgia sets 2.7% wider than Petrona, Arial 4.6%
   wider than Inter Tight, and both sit on a different baseline.
   These faces are the shapes the OS already has, re-metricked so
   the swap moves nothing.

   The mono had no fallback entry at all until now — it jumped
   straight to ui-monospace and reflowed the label rows on swap,
   which is most visible where tracking is widest.

   It is also the one entry that can be exact instead of sampled.
   Azeret Mono is fixed-advance at 0.650em for every glyph (A, 0, m
   and ç all measure identical) and Menlo at 0.60205em, so Menlo is
   7.4% narrower and 0.650/0.60205 = 107.96% is the true ratio, not
   an average over a text run. Overrides are pre-divided by
   size-adjust because it scales them too: 0.868 x 1.0796 = 0.937,
   Azeret's typo ascender.

   The src list is ordered by metric closeness, and the first name
   is deliberately "Menlo Regular", not "Menlo": local("Menlo")
   does not resolve in Chrome, so the whole face went to status
   error and the labels reflowed 6-7% on swap — the exact thing this
   block exists to prevent. Georgia and Helvetica Neue above happen
   to match on their family name, which is why those two entries
   never hit this. Verified by measuring rendered advances with
   fonts.gstatic.com blocked.

   Scaled advances against Azeret's 0.650em: Menlo and DejaVu Sans
   Mono land exact, Liberation Mono and Courier New 0.3% off,
   Consolas 8.6% off — so Consolas sits last, used only where
   nothing better exists.
   ------------------------------------------------------------- */
@font-face {
  font-family: "Petrona Fallback";
  src: local("Georgia"), local("Times New Roman"), local("Liberation Serif");
  size-adjust: 97.3%;
  ascent-override: 88.2%;
  descent-override: 27.7%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Inter Tight Fallback";
  src: local("Helvetica Neue"), local("Arial"), local("Liberation Sans");
  size-adjust: 94.9%;
  ascent-override: 102.1%;
  descent-override: 25.4%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Azeret Mono Fallback";
  src: local("Menlo Regular"), local("Menlo-Regular"), local("DejaVu Sans Mono"),
       local("Liberation Mono"), local("Courier New"), local("Consolas");
  size-adjust: 107.96%;
  ascent-override: 86.8%;
  descent-override: 21.3%;
  line-gap-override: 0%;
}

:root {
  --font-display: "Petrona", "Petrona Fallback", Georgia, "Times New Roman", serif;
  --font-body: "Inter Tight", "Inter Tight Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-mono: "Azeret Mono", "Azeret Mono Fallback", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Line-height by role. Tuned to the face, not a single ratio:
     Petrona has a 0.443 x-height and needs less leading at
     display sizes than Inter Tight needs in prose. */
  --lh-display: 1.02;
  --lh-heading: 1.18;
  --lh-body: 1.55;
  --lh-prose: 1.65;

  /* Reading measure. CSS `ch` is the advance of "0", NOT an average
     character: in Inter Tight 1ch = 0.5781em while an average pt-BR
     character is 0.4397em, so 1ch carries 1.315 real characters.
     These values are back-computed from the character counts named. */
  --measure-lede: 46ch;   /* ~60 characters */
  --measure-prose: 52ch;  /* ~68 characters */
  --measure-legal: 55ch;  /* ~72 characters — upper bound for long-form */

  /* The measure when it governs a column rather than a text element.
     Held in rem, not ch: `ch` reads the loaded font, so a column sized
     in it is 464px on the fallback and 509px once Inter Tight swaps in
     — a 45px jump that drags the headings and their rules along.

     38rem is --measure-legal (31.8rem in Inter Tight) widened 20%, so
     it runs past the ragged-right limit at ~86 characters. Justified
     text carries the extra width: the flush right edge keeps the eye's
     return sweep anchored, and more words per line means less stretch
     on the lines around long URLs. */
  --measure-legal-col: 38rem;
}

/* -------------------------------------------------------------
   2. Respect the reader's font size
   Every size on this site is now rem. Without this the type is
   immune to the browser's default-font-size setting, which is the
   most common accommodation among the 35-65 audience.
   ------------------------------------------------------------- */
html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

/* -------------------------------------------------------------
   3. Heading defaults
   22 headings between 1rem and 1.75rem declared no line-height and
   inherited body's 1.55, opening a 43px line box on a 28px title.
   Pages that set their own line-height still win.
   ------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  line-height: var(--lh-heading);
  text-wrap: balance;
}

h1 {
  line-height: var(--lh-display);
}

/* Long Portuguese compounds — "organizacionais", "acompanhamento",
   "responsabilidades" — against a 280px column at 320px. Nothing in
   the codebase allowed them to break. */
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

p, li {
  text-wrap: pretty;
}

/* -------------------------------------------------------------
   4. Tabular figures
   Petrona carries `tnum`; Fraunces did not. Prices, scores and
   animated counters can finally hold their columns instead of
   jittering as digits change.
   ------------------------------------------------------------- */
.stat__num,
.ind__num,
.plan__price-val,
.a-plan__price-val,
.p-plan-compact__price,
.modal__stat-num,
.pv-score__val,
.qs-number__val,
.device-score,
.m-patient-row__score,
.a-hero__stat-num,
.p-proof__num,
.m-proof__num {
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------
   5. Reading measure
   Long-form prose ran 85-133 characters per line. On the legal
   pages the measure sits on the column (see .pv-content__inner in
   each page), not on the paragraph: capping the text alone left it
   short of the headings' rules and read as a left-shifted block.
   The column carries it, so every edge lines up and justification
   has the full block to set against.

   .legal-doc is set by each page's loader on the wrapper it injects,
   so the loading and error notices stay centred rather than justified.
   ------------------------------------------------------------- */
.legal-doc p,
.legal-doc ul li,
.legal-doc ol li {
  text-align: justify;
  overflow-wrap: break-word;
}

/* The source markdown puts a `---` before each numbered section and the
   headings already carry a border-top, so every boundary was drawing two
   rules with dead space between them. The heading's rule is the one with
   controlled spacing, so the thematic break steps aside. */
.legal-doc hr {
  display: none;
}

.pv-content p.lede {
  max-width: var(--measure-prose);
}

.faq-body,
.a-faq__left p,
.m-faq__left p,
.p-faq__left p {
  max-width: var(--measure-prose);
}

.p-tour__lede,
.a-locations__lede,
.m-panel__lede,
.qs-cta__sub,
.c-hero__sub,
.philosophy__lede {
  max-width: var(--measure-lede);
}

.a-hero__disclaimer,
.p-tour__disclaimer {
  max-width: var(--measure-legal);
}

/* -------------------------------------------------------------
   6. Light text on dark
   Light-on-dark strokes optically thicken from halation while
   `-webkit-font-smoothing: antialiased` thins them. Compensate on
   the two axes that don't disturb layout: a little more leading and
   a little more tracking.
   ------------------------------------------------------------- */
.footer__tagline,
.footer__cols a,
.footer__bottom,
.footer__legal {
  line-height: 1.62;
  letter-spacing: 0.005em;
}

.footer__cols h4 {
  letter-spacing: 0.13em;
}
