/* Nacelle carries `font-display: swap`: the default (`auto`, i.e. block) hides
   text for up to 3s on a slow connection, and hiding it buys nothing — the
   layout during that period is already the fallback's, so the reflow when the
   real face lands happens either way. Swap only decides whether the reader can
   read while it is in flight. The three faces every screen paints with are
   preloaded from app.html and served brotli-precompressed, so that window is
   short; make it `optional` instead if a first cold load in the fallback font
   is preferable to a late swap. */

/* Nacelle's vertical metrics are pinned on every face below —
   `ascent-override: 77%`, `descent-override: 23%`, `line-gap-override: 20%`.
   Without them the same text sits 0.1em lower on macOS than on Linux/Android:
   3px at the header's 2rem day label, ~2px at 1.25rem, and the tab underline
   (absolutely positioned) does not move with it, so the labels drift off their
   own bar.

   The font ships two disagreeing answers. hhea and OS/2.usWin both say
   ascent 970 / descent 230 (a 1.2em content area); OS/2.sTypo says 770 / 230
   (1.0em), and fsSelection bit 7 (USE_TYPO_METRICS) is set, which asks for the
   typo pair. Skia honours that flag on its FreeType backend (Linux, Android,
   ChromeOS) and cannot on its CoreText one, where the metrics come from
   CTFontGetAscent/Descent — i.e. hhea — so macOS Chrome and Safari read 970.
   A glyph's baseline within a line box is `line-height/2 + (ascent - descent)/2`,
   which is 0.27em with the typo pair against 0.37em with hhea: the 0.1em.

   The overrides are the typo values, so this is a no-op wherever the flag was
   already being honoured and macOS/iOS come up to meet it. Keep them in step
   with the three faces declared inline in src/app.html — those are the same
   family/weight/style, so whichever declaration parses last wins, and one side
   carrying the overrides while the other does not would swap the baseline
   under the reader when this sheet lands.

   The .otf files themselves have since been normalized too
   (scripts/normalize-font-metrics.mjs rewrites hhea's 970 to the typo 770), so
   the font now gives one answer whoever asks and these descriptors are the
   second line of defence rather than the only one. Both are worth keeping: the
   descriptors also cover a platform that reads OS/2.usWin, which the script
   deliberately leaves at 970 because those are raster clipping bounds; the
   normalized files cover browsers older than the descriptors (Safari < 16.4)
   and any copy of this sheet a cache is still holding. */

/* Thin */
@font-face {
  font-family: 'Nacelle';
  font-weight: 100;
  font-style: normal;
  font-display: swap;
  src: url(/public/Nacelle/Nacelle-Thin.otf) format('opentype');
  ascent-override: 77%;
  descent-override: 23%;
  line-gap-override: 20%;
}

/* Thin Italic */
@font-face {
  font-family: 'Nacelle';
  font-weight: 100;
  font-style: italic;
  font-display: swap;
  src: url(/public/Nacelle/Nacelle-ThinItalic.otf) format('opentype');
  ascent-override: 77%;
  descent-override: 23%;
  line-gap-override: 20%;
}

/* Ultra Light */
@font-face {
  font-family: 'Nacelle';
  font-weight: 200;
  font-style: normal;
  font-display: swap;
  src: url(/public/Nacelle/Nacelle-UltraLight.otf) format('opentype');
  ascent-override: 77%;
  descent-override: 23%;
  line-gap-override: 20%;
}

/* Ultra Light Italic */
@font-face {
  font-family: 'Nacelle';
  font-weight: 200;
  font-style: italic;
  font-display: swap;
  src: url(/public/Nacelle/Nacelle-UltraLightItalic.otf) format('opentype');
  ascent-override: 77%;
  descent-override: 23%;
  line-gap-override: 20%;
}

/* Light */
@font-face {
  font-family: 'Nacelle';
  font-weight: 300;
  font-style: normal;
  font-display: swap;
  src: url(/public/Nacelle/Nacelle-Light.otf) format('opentype');
  ascent-override: 77%;
  descent-override: 23%;
  line-gap-override: 20%;
}

/* Light Italic */
@font-face {
  font-family: 'Nacelle';
  font-weight: 300;
  font-style: italic;
  font-display: swap;
  src: url(/public/Nacelle/Nacelle-LightItalic.otf) format('opentype');
  ascent-override: 77%;
  descent-override: 23%;
  line-gap-override: 20%;
}

/* Regular */
@font-face {
  font-family: 'Nacelle';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url(/public/Nacelle/Nacelle-Regular.otf) format('opentype');
  ascent-override: 77%;
  descent-override: 23%;
  line-gap-override: 20%;
}

/* Regular Italic */
@font-face {
  font-family: 'Nacelle';
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  src: url(/public/Nacelle/Nacelle-Italic.otf) format('opentype');
  ascent-override: 77%;
  descent-override: 23%;
  line-gap-override: 20%;
}

/* Semi-Bold */
@font-face {
  font-family: 'Nacelle';
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url(/public/Nacelle/Nacelle-SemiBold.otf) format('opentype');
  ascent-override: 77%;
  descent-override: 23%;
  line-gap-override: 20%;
}

/* Semi-Bold Italic */
@font-face {
  font-family: 'Nacelle';
  font-weight: 600;
  font-style: italic;
  font-display: swap;
  src: url(/public/Nacelle/Nacelle-SemiBoldItalic.otf) format('opentype');
  ascent-override: 77%;
  descent-override: 23%;
  line-gap-override: 20%;
}

/* Bold */
@font-face {
  font-family: 'Nacelle';
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url(/public/Nacelle/Nacelle-Bold.otf) format('opentype');
  ascent-override: 77%;
  descent-override: 23%;
  line-gap-override: 20%;
}

/* Bold Italic */
@font-face {
  font-family: 'Nacelle';
  font-weight: 700;
  font-style: italic;
  font-display: swap;
  src: url(/public/Nacelle/Nacelle-BoldItalic.otf) format('opentype');
  ascent-override: 77%;
  descent-override: 23%;
  line-gap-override: 20%;
}

/* Heavy */
@font-face {
  font-family: 'Nacelle';
  font-weight: 800;
  font-style: normal;
  font-display: swap;
  src: url(/public/Nacelle/Nacelle-Heavy.otf) format('opentype');
  ascent-override: 77%;
  descent-override: 23%;
  line-gap-override: 20%;
}

/* Heavy Italic */
@font-face {
  font-family: 'Nacelle';
  font-weight: 800;
  font-style: italic;
  font-display: swap;
  src: url(/public/Nacelle/Nacelle-HeavyItalic.otf) format('opentype');
  ascent-override: 77%;
  descent-override: 23%;
  line-gap-override: 20%;
}

/* Black */
@font-face {
  font-family: 'Nacelle';
  font-weight: 900;
  font-style: normal;
  font-display: swap;
  src: url(/public/Nacelle/Nacelle-Black.otf) format('opentype');
  ascent-override: 77%;
  descent-override: 23%;
  line-gap-override: 20%;
}

/* Black Italic */
@font-face {
  font-family: 'Nacelle';
  font-weight: 900;
  font-style: italic;
  font-display: swap;
  src: url(/public/Nacelle/Nacelle-BlackItalic.otf) format('opentype');
  ascent-override: 77%;
  descent-override: 23%;
  line-gap-override: 20%;
}

/* Fira Mono — code blocks and inline code in chat markdown
   (`responseContent` in src/mixins.scss). Never on a first paint, so these are
   deliberately not preloaded from app.html and not in the service worker's
   font cache: they load with this (deferred) stylesheet, when a transcript
   containing code asks for them. `swap` for the same reason as Nacelle —
   blocking would hide the code, not prevent the reflow. */

/* Regular */
@font-face {
  font-family: 'Fira-Mono';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url(/public/Fira_Mono/FiraMono-Regular.ttf) format('truetype');
}

/* Medium */
@font-face {
  font-family: 'Fira-Mono';
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url(/public/Fira_Mono/FiraMono-Medium.ttf) format('truetype');
}

/* Bold */
@font-face {
  font-family: 'Fira-Mono';
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url(/public/Fira_Mono/FiraMono-Bold.ttf) format('truetype');
}
