/*
 * SITE STYLES — shared by every page. Built for desktop; section 8 adapts it to phones.
 *
 *   1. Fonts
 *   2. Design values (colors, sizes, fonts) — start here to change the look
 *   3. Base elements
 *   4. Header (logo, Steam link, EN / FR)
 *   5. Logo band and sections
 *   6. About us text
 *   7. Footer
 *   8. Phones
 *
 * Styles for the game cards are in games.css.
 */

/* ---------- 1. Fonts (bundled locally in assets/fonts/) ---------- */

/* "font-display: block" waits a moment for the font instead of flashing a
   substitute font first. The pages preload the fonts so the wait is short. */

@font-face {
  font-family: 'Libre Franklin';
  font-weight: 400;
  font-display: block;
  src: url('../assets/fonts/libre-franklin-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Libre Franklin';
  font-weight: 700;
  font-display: block;
  src: url('../assets/fonts/libre-franklin-bold.woff2') format('woff2');
}
/* Geist Pixel Square: the second file is used first; the first fills in extra accented letters. */
@font-face {
  font-family: 'Geist Pixel';
  font-weight: 400;
  font-display: block;
  src: url('../assets/fonts/geist-pixel-latin-ext.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist Pixel';
  font-weight: 400;
  font-display: block;
  src: url('../assets/fonts/geist-pixel-latin.woff2') format('woff2');
}

/* ---------- 2. Design values ---------- */

:root {
  color-scheme: dark;

  /* Colors */
  --background: #00000f;
  /* Navy shades of the background, a step lighter each */
  --panel: #05051a; /* game cards */
  --panel-raised: #0d0d2a; /* current language, thumbnails while loading */
  --text: #ececf2;
  --muted: #9a9ab4;
  --accent: #f4c430; /* the sun in the logo */
  --on-accent: #111111; /* text on accent buttons */
  --border: #18183a;

  --radius: 6px;

  /* Fonts: pixel for headings, Libre Franklin for everything else */
  --text-font: 'Libre Franklin', Arial, sans-serif;
  --heading-font: 'Geist Pixel', monospace;

  /* Layout: one content width for header, sections and footer */
  /* 1160px up to a 1550px window, then 75% of the window, at most 1680px (2240px window and up). */
  --content-width: clamp(1160px, 75vw, 1680px);
  --header-height: 64px;
}

/* ---------- 3. Base elements ---------- */

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  /* Section links stop below the sticky header. */
  scroll-padding-top: calc(var(--header-height) + 24px);
}
body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--text-font);
  font-size: 16px;
  line-height: 1.6;
}
button {
  font: inherit;
}
a {
  color: inherit;
  text-decoration: none;
}
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
img {
  display: block;
  max-width: 100%;
  height: auto;
}
h1,
h2,
h3,
.empty-note {
  font-family: var(--heading-font);
  font-weight: 400;
  font-synthesis: none;
  line-height: 1.15;
}
[hidden] {
  display: none !important;
}
/* Present for screen readers, invisible on screen. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
/* The same width everywhere: header, sections, footer. */
.wrap {
  width: min(100% - 96px, var(--content-width));
  margin-inline: auto;
}
a,
button {
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  ::before,
  ::after {
    transition: none !important;
  }
}

/* Line icons created by icon() in js/dom.js. */
.icon {
  display: block;
  width: var(--icon-size, 24px); /* the fullscreen viewer scales it (css/games.css) */
  height: var(--icon-size, 24px);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- 4. Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--background);
  border-bottom: 1px solid var(--border); /* a line a bit lighter than the page, like the footer's */
}
/* The header's Steam link: its text, then the icon (wins over `.socials a` in section 7). */
.site-header .header-socials a {
  width: auto;
  gap: 8px;
  grid-auto-flow: column;
  font-size: 14px;
}
/* Icons and EN / FR on the right; the logo centered on the whole header. */
.site-header .wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  height: var(--header-height);
}
/* The logo on one line, without the arc (assets/images/logo-line-no-arc.png); the image includes
   the sun's glow above and below the letters, so the letters themselves are about 22px. */
.site-logo {
  position: absolute;
  left: 50%;
  translate: -50% 0;
}
.site-logo img {
  width: auto;
  height: 40px;
}
/* EN / FR after the icons, behind a thin line. */
.language-switch {
  display: flex;
  gap: 2px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
  font-size: 13px;
}
.language-switch a {
  padding: 4px 8px;
  border-radius: var(--radius);
  color: var(--muted);
}
.language-switch a:hover {
  color: var(--text);
}
.language-switch a[aria-current] {
  color: var(--text);
  background: var(--panel-raised);
}

/* ---------- 5. Logo band (with About us) and sections ---------- */

/* The logo animation (assets/video/logo-anim-alpha.webm, 1920 × 882): transparent, already
   cropped to the logo, so it sits straight on the page background. It grows with the
   content width: 58% of it on desktop (phones and tablets: 20% smaller, in section 8).
   Safari and iPhones get the same animation as a picture, at the same size (js/home.js). */
.home-intro {
  display: block;
  width: min(100%, var(--content-width) * 0.58);
  height: auto;
  margin: 24px auto 0;
}
/* About us, centered under the logo. */
.home-band .about-content {
  max-width: 640px;
  margin: -8px auto 0;
  padding: 0 24px 48px;
  color: var(--muted);
  text-align: center;
}

.home-section {
  padding-block: 72px 48px; /* the bottom: the gap above the footer */
}
.page-title {
  margin: 0 0 32px;
  font-size: 40px;
}

/* ---------- 6. About us text ---------- */

.about-content p {
  margin: 0 0 6px;
}
.about-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* "Come back later!" in an empty section (emptyNote() in js/dom.js). */
.empty-note {
  color: var(--muted);
  font-size: 22px;
}

/* ---------- 7. Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border); /* a line a bit lighter than the page, like the header's */
  color: var(--muted);
  font-size: 14px;
}
.site-footer .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 24px;
}
/* Social icons, in the footer and the header. */
.socials {
  display: flex;
  align-items: center;
  gap: 6px;
}
.socials a {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--muted);
}
/* Gray; white under the pointer. */
.socials a:hover,
.socials a:focus-visible {
  color: #ffffff;
}
/* The icon: its SVG masks a box in the link's current color. */
.social-icon {
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: center / contain no-repeat;
  mask: center / contain no-repeat;
}

/* ---------- 8. Phones and tablets held upright (game cards: the end of games.css) ---------- */

@media (max-width: 900px) {
  .wrap {
    width: calc(100% - 32px);
  }
  /* Header: logo on the left (centered, it would run into the right side); the Steam
     link is its icon alone, its text kept for screen readers. */
  .site-header .wrap {
    justify-content: space-between;
    gap: 16px;
  }
  .site-logo {
    position: static;
    translate: none;
  }
  .site-logo img {
    height: 32px;
  }
  .site-header .header-socials span:not(.social-icon) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .site-header .header-socials {
    margin-left: auto;
  }
  .home-intro {
    width: min(80%, var(--content-width) * 0.464); /* 20% smaller than desktop's rule */
  }
  .home-band .about-content {
    padding: 0 16px 32px;
    font-size: 15px;
  }
  .home-section {
    padding-block: 40px 32px;
  }
  .page-title {
    margin-bottom: 20px;
    font-size: 30px;
  }
  /* Footer: the text above the icons, both centered. */
  .site-footer .wrap {
    flex-direction: column;
    gap: 12px;
    padding-block: 20px;
    text-align: center;
  }
}
