/* Inter and Playfair Display, served from this site.
 *
 * These were Google's, via a <link> to fonts.googleapis.com. Self-hosting them
 * is not a privacy decision dressed up as a performance one, though it is
 * that too -- every page view was telling two Google properties that somebody
 * opened a wedding invitation. The performance case is the more interesting
 * one and it is mostly about connections rather than bytes:
 *
 *   - The stylesheet was a render-blocking request to a third origin. It had
 *     to resolve DNS, open a TLS connection and negotiate ALPN before the
 *     browser learned which font files to fetch, and none of that could start
 *     until the HTML was parsed. From here the @font-face rules are in a file
 *     already being fetched for the page, so the font requests go out one hop
 *     earlier and off a connection the page already has.
 *   - Google serves a different stylesheet to every user agent and splits the
 *     files across seven subsets. The browser picks one and fetches it, but it
 *     cannot fetch it until the stylesheet has arrived and been parsed, so the
 *     font is at least two round trips behind the text that needs it.
 *
 * The bytes are a wash and were never the point: the same six files come over
 * the wire either way, and they are cached for a year either way.
 *
 * What is genuinely different is the subsetting. Google's stylesheet splits
 * latin from latin-ext, and so does this one, using the same unicode-range
 * values. A page with no accented characters in it never fetches the
 * latin-ext files at all -- which on the builder, the sign-in page and the
 * dashboard is three of the four pages on the site, and the latin-ext Inter is
 * 85KB, by a wide margin the largest file here. Those three pages now download
 * 87KB of font where they were downloading 172KB.
 *
 * Only latin and latin-ext are here. The other five subsets Google offers cover
 * Cyrillic, Greek and Vietnamese, which this site has no text for, and
 * Sinhala and Tamil -- the languages the eight themes are named after -- are
 * not in Inter or Playfair to begin with. Shipping them would add weight for
 * glyphs that do not exist. A name in a script neither font covers falls
 * through to the system stack either way, as it did before.
 *
 * Both faces are variable, which is why there are three files per family and
 * not nine. Google hands out the same file for every weight it is asked for
 * because it is one file with a wght axis, and the weights used here -- 400,
 * 500, 600 -- are points on it rather than separate cuts. Verified with
 * fontTools: Inter spans 100-900, Playfair Display 400-900. Declaring a range
 * rather than three @font-face rules is also three fewer requests and no risk
 * of a browser picking the 500 cut for 600 and synthesising the difference.
 *
 * font-display is swap, unchanged. That is the one setting worth arguing
 * about, and here it is the right one: a wedding invitation is text the guest
 * is waiting to read, and Georgia is a perfectly good serif for the 200ms it
 * takes to arrive. The alternative, optional, would be the way to remove the
 * remaining reflow -- it never swaps -- but on a cold cache it would show this
 * whole site in Georgia and then keep it there, and on a page whose entire
 * subject is a serif card, that is not a trade worth making for a little
 * stability. The reflow is confined to the wordmark, the couple's names and the
 * date, and it is 200ms.
 */

/* Inter. 100-900 on the wght axis. */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fonts/inter-latin.woff2?v=1") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
        U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
        U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fonts/inter-latin-ext.woff2?v=1") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
        U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
        U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Playfair Display, roman. 400-900 on the wght axis; the family has no
   lighter cut than 400, which is why the range does not start at 100. */
@font-face {
    font-family: "Playfair Display";
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url("/fonts/playfair-latin.woff2?v=1") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
        U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
        U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Playfair Display";
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url("/fonts/playfair-latin-ext.woff2?v=1") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
        U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
        U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Playfair Display, italic. A separate file, not a slanted roman: the real
   italic is one of the five places the invite page sets font-style, and it
   carries the opening lines and the "Dear Nimala," greeting, so it is on
   screen at the exact moment a guest is deciding what this invitation looks
   like. A synthesised oblique would be visibly wrong there. */
@font-face {
    font-family: "Playfair Display";
    font-style: italic;
    font-weight: 400 900;
    font-display: swap;
    src: url("/fonts/playfair-italic-latin.woff2?v=1") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
        U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
        U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Playfair Display";
    font-style: italic;
    font-weight: 400 900;
    font-display: swap;
    src: url("/fonts/playfair-italic-latin-ext.woff2?v=1") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
        U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
        U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
