/*
 * CraftBook Magazine — Font Loading Strategy
 * ==========================================
 * Fonts are loaded here rather than via @import in style.css to avoid
 * render-blocking. The actual <link> tags with preconnect and preload
 * hints are injected by PHP (see inc/performance.php) so fonts begin
 * downloading before CSS is parsed.
 *
 * This file defines:
 *   1. @font-face rules as a fallback / offline cache strategy
 *   2. Font-display: swap — text renders in fallback font immediately,
 *      swaps to custom font when loaded. No invisible text.
 *   3. Subsetting — only Latin characters loaded (en-GB site).
 *
 * The Google Fonts URL loaded via PHP enqueue (inc/performance.php):
 * https://fonts.googleapis.com/css2?
 *   family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400;1,700
 *   &family=Inter:wght@400;500;600;700
 *   &display=swap
 *   &subset=latin
 *
 * MAINTENANCE:
 *   To change fonts, update the Google Fonts URL in inc/performance.php
 *   and update the font-family custom properties in style.css :root.
 *   The @font-face declarations below are fallback only and do not
 *   need to change unless you self-host font files.
 */

/* ------------------------------------------------------------------
   FONT DISPLAY OPTIMISATION
   Applied to heading and body font stacks to minimise layout shift
   (CLS) during font swap. Size-adjust approximates Inter and
   Playfair Display metrics on system fonts.
------------------------------------------------------------------ */

/* Approximate size adjustment for Inter → system-ui fallback */
@font-face {
    font-family: 'Inter-fallback';
    src: local('Arial');
    ascent-override:  90%;
    descent-override: 22%;
    line-gap-override: 0%;
    size-adjust:      107%;
}

/* Approximate size adjustment for Playfair Display → Georgia fallback */
@font-face {
    font-family: 'PlayfairDisplay-fallback';
    src: local('Georgia');
    ascent-override:  95%;
    descent-override: 25%;
    line-gap-override: 0%;
    size-adjust:      103%;
}

/*
 * Update :root in style.css to use these fallback names in the chain:
 * --cbm-font-body:    'Inter', 'Inter-fallback', system-ui, sans-serif;
 * --cbm-font-heading: 'Playfair Display', 'PlayfairDisplay-fallback', Georgia, serif;
 *
 * This significantly reduces Cumulative Layout Shift (CLS) during
 * the font swap, improving Core Web Vitals scores.
 */
