/* ==========================================================================
   base.css
   Fonts, a small reset, the night sky behind the card, and shared helpers.
   Reads every value from tokens.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Fonts
   Three subsets of Cormorant Garamond 600. The browser downloads a subset
   only when the page uses one of its characters, so English text fetches
   the Latin file and "Привет" fetches the Cyrillic one.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/cormorant-garamond-600-latin.woff2") 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: "Cormorant Garamond";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/cormorant-garamond-600-latin-ext.woff2") 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;
}

@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/cormorant-garamond-600-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body,
h1,
p {
  margin: 0;
}

svg {
  display: block;
}

/* --------------------------------------------------------------------------
   The sky
   The root element paints the night and its glows. Two layers of stars sit
   on top, tiled at 211px and 307px. Both are prime numbers, so the two
   patterns only line up again every 64,777px and the sky never looks tiled.
   -------------------------------------------------------------------------- */

html {
  min-height: 100%;
  color-scheme: dark;
  background-color: var(--color-night);
  background-image:
    radial-gradient(ellipse 34% 28% at 80% 86%, var(--glow-copper), transparent 70%),
    radial-gradient(ellipse 58% 46% at 60% 36%, var(--glow-nebula), transparent 72%),
    radial-gradient(ellipse 46% 56% at 24% 74%, var(--glow-orchid), transparent 70%),
    radial-gradient(ellipse 130% 100% at 50% 50%, transparent 45%, var(--sky-edge) 100%);
}

body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding:
    max(var(--space-4), env(safe-area-inset-top))
    max(var(--space-4), env(safe-area-inset-right))
    max(var(--space-4), env(safe-area-inset-bottom))
    max(var(--space-4), env(safe-area-inset-left));
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: var(--weight-body);
  line-height: var(--leading-body);
  color: var(--color-starlight);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* Small, faint stars */
body::before {
  background-image:
    radial-gradient(1px 1px at 23px 41px, var(--star-bright), transparent),
    radial-gradient(0.8px 0.8px at 97px 13px, var(--star-dim), transparent),
    radial-gradient(1px 1px at 163px 77px, var(--star-dim), transparent),
    radial-gradient(0.8px 0.8px at 51px 139px, var(--star-bright), transparent),
    radial-gradient(1px 1px at 131px 181px, var(--star-dim), transparent),
    radial-gradient(0.8px 0.8px at 191px 157px, var(--star-dim), transparent);
  background-size: 211px 211px;
  opacity: 0.8;
}

/* Fewer, brighter stars, one lavender and one copper */
body::after {
  background-image:
    radial-gradient(1.4px 1.4px at 67px 89px, var(--star-bright), transparent),
    radial-gradient(1.3px 1.3px at 241px 37px, var(--star-lavender), transparent),
    radial-gradient(1.2px 1.2px at 173px 263px, var(--star-bright), transparent),
    radial-gradient(1.5px 1.5px at 283px 199px, var(--star-copper), transparent);
  background-size: 307px 307px;
}

/* --------------------------------------------------------------------------
   Shared helpers
   -------------------------------------------------------------------------- */

/* Hidden on screen, still read aloud by screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

::selection {
  background-color: var(--color-copper);
  color: var(--color-night-deep);
}
