/* L'Humanité demo page: their site's header, imitated with their agreement, above our games.
   Fonts: Tanker and Overpass are used when the reader's device has them; no external font is loaded, and the fallbacks keep the layout. To ship them, add the files L'Humanité supplies in
   fonts/ and a url() after each local(). */

@font-face {
  font-family: 'Tanker';
  src: local('Tanker'), local('Tanker-Regular');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Overpass';
  src: local('Overpass'), local('Overpass-Regular');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Overpass';
  src: local('Overpass Bold'), local('Overpass-Bold');
  font-weight: 700;
  font-display: swap;
}

:root {
  --hm-purple: #280036;
  --hm-purple-50: rgba(40, 0, 54, 0.5);
  --hm-red: #f13c47;
  --hm-yellow: #ffd600;
  --hm-line: #93809a;
  --hm-mist: #ebf2f2;
  --hm-white: #ffffff;
  /* The games banner's ground and soft colours (with --hm-red). */
  --hm-banner-ground: #2a2030;
  --hm-banner-teal: #4f95a3;
  --hm-banner-gold: #e9b55b;
  --hm-font-title: 'Tanker', 'Anton', Impact, 'Haettenschweiler', 'Arial Narrow Bold', sans-serif;
  --hm-font-text: 'Overpass', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  --hm-gutter: 1.875rem;
  /* The header's heights, open and compact (with its 1px bottom line): the games frame takes the
     reader's visible height less the compact header, so the games bar stays in sight under it. */
  --hm-header-open: 112px;
  --hm-header-compact: 77px;
  /* The games frame's ground while it loads: the games bar's own light colour (the publisher
     theme's accentSecondary), so the frame does not flash another colour before the Game Hub
     shows. Change both together. */
  --hm-games-ground: #faf7fb;
  --mg-embed-bg: var(--hm-games-ground);
  /* The games' rounded top-left corner, drawn by the banner's mask over the top of the frame. */
  --hm-curve: 2rem;
}
@media (min-width: 62.5rem) {
  :root {
    --hm-gutter: clamp(1.875rem, 6vw, 5rem);
    --hm-header-open: 135px;
    --hm-header-compact: 91px;
    --hm-curve: 3.75rem;
  }
}

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

/* The page rests either at its top or with the games right under the compact header. */
html {
  -webkit-text-size-adjust: 100%;
  scroll-snap-type: y proximity;
  scroll-padding-top: var(--hm-header-compact);
}
/* At the top, the page does not snap (humanite.js sets the class). The header unfolding there, and
   Safari's bars showing again, lay the page out anew; Safari on iPhone then appears to re-snap it to
   the last point it had snapped to, the games (QA #668, suspected, not reproduced off an iPhone).
   Scrolling away turns the snap back on. */
html.hm-at-top {
  scroll-snap-type: none;
}

/* The top point sits at the compact header's height: the scroll padding above then brings its
   snap position to exactly 0. At top: 0 it would sit above the page's start. */
.hm-snap-top {
  position: absolute;
  top: var(--hm-header-compact);
  left: 0;
  width: 1px;
  height: 1px;
  scroll-snap-align: start;
}

body {
  margin: 0;
  /* The header is fixed: its folding never changes the page's height or moves the games. */
  padding-top: var(--hm-header-open);
  background: var(--hm-white);
  color: var(--hm-purple);
  font-family: var(--hm-font-text);
}

body.hm-drawer-open {
  overflow: hidden;
}

.hm-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.hm-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.hm-wrap {
  width: 100%;
  max-width: 90rem;
  margin: 0 auto;
  padding: 0 var(--hm-gutter);
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--hm-red);
  outline-offset: 3px;
}

/* ---- Header ---------------------------------------------------------------------------------- */

.hm-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  padding-top: 1rem;
  background: var(--hm-white);
  border-bottom: 1px solid var(--hm-line);
}

.hm-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 50px;
  margin-bottom: 1rem;
  transition: margin-bottom 0.4s;
}
.hm-header.is-compact .hm-top {
  margin-bottom: 0.625rem;
}

.hm-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--hm-purple);
  cursor: pointer;
}
.hm-icon-button svg {
  display: block;
  width: 100%;
  height: 100%;
}

.hm-tools {
  display: flex;
  align-items: center;
  /* On a phone the burger sits on the right, as on humanite.fr. */
  grid-column: 3;
  grid-row: 1;
  justify-content: flex-end;
}
.hm-burger {
  width: 1.8125rem;
  height: 1.125rem;
}
.hm-search {
  display: none;
  width: 1.8125rem;
  height: 1.8125rem;
  margin-left: 1.875rem;
}

.hm-logo {
  grid-column: 2;
  grid-row: 1;
  display: block;
  width: 10.5625rem;
  color: var(--hm-red);
  transform-origin: center center;
  transition: transform 0.3s;
  will-change: transform;
}
.hm-logo svg {
  display: block;
  width: 100%;
  height: auto;
}
.hm-header.is-compact .hm-logo {
  transform: scale(0.9);
}

.hm-account {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
}
.hm-login {
  display: inline-flex;
  align-items: center;
  color: #000;
  font-size: 0.875rem;
  font-weight: 300;
  line-height: 1.45;
  text-decoration: none;
  white-space: nowrap;
}
.hm-login svg {
  width: 1.6875rem;
  height: 1.8125rem;
}
.hm-login-label,
.hm-subscribe {
  display: none;
}
.hm-subscribe {
  align-items: center;
  min-height: 2.5rem;
  padding: 0.625rem 1.5rem 0.625rem 1.25rem;
  border-radius: 3.125rem;
  background: var(--hm-yellow);
  color: var(--hm-purple);
  font-family: var(--hm-font-title);
  font-size: 1.25rem;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background-color 0.3s, color 0.3s;
}
.hm-subscribe:hover {
  background: var(--hm-purple);
  color: var(--hm-yellow);
}
.hm-subscribe svg {
  width: 1.125rem;
  height: 1.0625rem;
  margin-right: 0.625rem;
}

/* The sections menu: folds away while the reader scrolls down. */
.hm-menu {
  max-height: 2.5rem;
  visibility: visible;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  transition: max-height 0.4s, visibility 0s linear 0s;
}
.hm-menu::-webkit-scrollbar {
  display: none;
}
/* Folded, its links leave the tab order once the fold has run. */
.hm-header.is-compact .hm-menu {
  max-height: 0;
  visibility: hidden;
  transition: max-height 0.4s, visibility 0s linear 0.4s;
}

.hm-menu-list {
  display: flex;
  gap: 1.25rem;
  width: max-content;
  margin: 0 auto;
  list-style: none;
}
.hm-menu-list li {
  position: relative;
  flex: none;
}
.hm-menu-list a {
  position: relative;
  display: block;
  padding-bottom: 1rem;
  color: var(--hm-purple-50);
  font-size: 0.8125rem;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.3s;
}
.hm-menu-list a::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0.3125rem;
  background: var(--hm-purple);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.35s;
  will-change: transform;
}
.hm-menu-list a:hover {
  color: var(--hm-purple);
}
.hm-menu-list a:hover::before {
  transform: scaleX(1);
  transform-origin: left center;
}
.hm-menu-list .hm-strong a {
  color: var(--hm-purple);
  font-weight: 700;
}
.hm-menu-list .hm-strong a::before {
  content: none;
}
.hm-separator {
  width: 1px;
  height: 1.8125rem;
  background: var(--hm-line);
  transform: translateY(-6px);
}

@media (min-width: 62.5rem) {
  .hm-top {
    margin-bottom: 2rem;
  }
  .hm-header.is-compact .hm-top {
    margin-bottom: 1.5rem;
  }
  .hm-tools {
    grid-column: 1;
    justify-content: flex-start;
  }
  .hm-search {
    display: inline-flex;
  }
  .hm-logo {
    width: 18.125rem;
  }
  .hm-account {
    grid-column: 3;
    justify-content: flex-end;
  }
  .hm-login {
    margin-right: 1.875rem;
  }
  .hm-login svg {
    margin-left: 0.625rem;
  }
  .hm-login-label {
    display: inline;
  }
  .hm-subscribe {
    display: inline-flex;
  }
  .hm-menu-list {
    justify-content: space-between;
    width: 100%;
  }
  /* One line height at every desktop size, so the open header keeps its height (--hm-header-open). */
  .hm-menu-list a {
    font-size: 0.875rem;
    line-height: 1.25rem;
  }
  .hm-separator {
    height: 2.25rem;
    transform: translateY(-4px);
  }
}
@media (min-width: 62.5rem) and (max-width: 68.75rem) {
  .hm-menu-list a {
    font-size: 0.6875rem;
  }
}
@media (min-width: 90.0625rem) {
  .hm-menu-list a {
    font-size: 1.0625rem;
  }
}

/* ---- Drawer (burger and search) -------------------------------------------------------------- */

.hm-drawer {
  position: fixed;
  inset: 0;
  z-index: 300;
}
.hm-drawer[hidden] {
  display: none;
}
.hm-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 20, 0.3);
  opacity: 0;
  transition: opacity 0.3s;
}
.hm-drawer-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  overflow-y: auto;
  padding: 1.25rem var(--hm-gutter) 2.5rem;
  background: var(--hm-white);
  transform: translateX(-100%);
  transition: transform 0.35s ease-out;
}
.hm-drawer.is-open .hm-drawer-backdrop {
  opacity: 1;
}
.hm-drawer.is-open .hm-drawer-panel {
  transform: none;
}
@media (min-width: 40rem) {
  .hm-drawer-panel {
    width: 23.75rem;
    padding-left: 1.875rem;
    padding-right: 1.875rem;
  }
}

.hm-drawer-close {
  display: flex;
  width: 1.5625rem;
  height: 1.5625rem;
  margin: 0 0 1.5rem auto;
}

.hm-drawer-search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 2.8125rem;
  margin-bottom: 2rem;
  padding: 0 0.875rem;
  border-radius: 0.375rem;
  background: var(--hm-mist);
}
.hm-drawer-search svg {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--hm-purple);
}
.hm-drawer-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--hm-purple);
  font: inherit;
  font-size: 1rem;
  outline: none;
}
.hm-drawer-search input::placeholder {
  color: var(--hm-purple-50);
}

.hm-drawer-list,
.hm-drawer-sub,
.hm-drawer-more {
  margin: 0;
  padding: 0;
  list-style: none;
}
.hm-drawer-list > li {
  margin-bottom: 1.25rem;
}
.hm-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--hm-purple);
  font-family: var(--hm-font-title);
  font-size: 2.4375rem;
  line-height: 1;
  text-align: left;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}
.hm-drawer-head-red {
  color: var(--hm-red);
}
.hm-drawer-head svg {
  flex: none;
  width: 0.5rem;
  height: 0.875rem;
  transition: transform 0.3s;
}
.hm-drawer-head[aria-expanded='true'] svg {
  transform: rotate(90deg);
}
.hm-drawer-sub {
  padding: 0.75rem 0 0.25rem;
}
.hm-drawer-sub a {
  display: block;
  padding: 0.375rem 0;
  font-size: 1.0625rem;
  text-decoration: none;
}
.hm-drawer-sub a:hover,
.hm-drawer-more a:hover {
  color: var(--hm-red);
}
.hm-drawer-more {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--hm-line);
}
.hm-drawer-more a {
  display: block;
  padding: 0.375rem 0;
  font-weight: 700;
  text-decoration: none;
}

/* ---- Banner ---------------------------------------------------------------------------------- */

/* The games page's banner: soft blurred colours on a dark ground, the title in white. Its lower part
   (--hm-curve) lies over the top of the games frame, masked away but for the games' rounded
   top-left corner: the corner is the banner's own pixels over the frame, never a band of a colour
   of its own above it, which could not match every screen of the games (the Game Hub's bar, each
   game's ground). It lets every click through to the frame. */
.hm-banner {
  position: relative;
  z-index: 1;
  pointer-events: none;
  -webkit-mask:
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--hm-curve)) no-repeat,
    radial-gradient(circle at 100% 100%, transparent calc(var(--hm-curve) - 0.75px), #000 var(--hm-curve))
      left bottom / var(--hm-curve) var(--hm-curve) no-repeat;
  mask:
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--hm-curve)) no-repeat,
    radial-gradient(circle at 100% 100%, transparent calc(var(--hm-curve) - 0.75px), #000 var(--hm-curve))
      left bottom / var(--hm-curve) var(--hm-curve) no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(6.5rem + var(--hm-curve));
  padding-bottom: var(--hm-curve);
  background-color: var(--hm-banner-ground);
  background-image:
    radial-gradient(ellipse 30% 80% at 7% 40%, var(--hm-banner-teal) 25%, transparent 100%),
    radial-gradient(ellipse 22% 80% at 36% 80%, var(--hm-red) 20%, transparent 100%),
    radial-gradient(ellipse 30% 90% at 88% 62%, var(--hm-banner-gold) 30%, transparent 100%);
}
.hm-banner-title {
  margin: 0;
  color: var(--hm-white);
  font-family: var(--hm-font-title);
  font-size: 2.75rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
@media (min-width: 62.5rem) {
  .hm-banner {
    height: calc(10.5rem + var(--hm-curve));
  }
  .hm-banner-title {
    font-size: 4.5rem;
  }
}

/* ---- Games ----------------------------------------------------------------------------------- */

.hm-games {
  display: block;
}
.hm-games-panel {
  position: relative;
  /* The frame starts under the banner's lower part, whose mask draws the rounded corner over it:
     no clip-path (jagged edge) and no overflow, which the embed forbids around its frame and which
     would take the scroll snap away from the page. */
  margin-top: calc(-1 * var(--hm-curve));
  background: var(--hm-games-ground);
}
.hm-games .mg-embed {
  scroll-snap-align: start;
}
/* embed.js sizes the frame to the reader's whole visible height; on this page it takes that height
   less the compact header, so the games bar is never under the header once it has folded.
   A stopgap until task E2 has embed.js give the height left under the header: remove it then. */
.hm-games .mg-embed iframe {
  height: max(480px, calc(100vh - var(--hm-header-compact))) !important;
}
@supports (height: 100svh) {
  .hm-games .mg-embed iframe {
    height: max(480px, calc(100svh - var(--hm-header-compact))) !important;
  }
}

/* ---- Footer ---------------------------------------------------------------------------------- */

.hm-footer {
  scroll-snap-align: end;
  padding: 2.5rem 0 3rem;
  background: var(--hm-purple);
  color: var(--hm-mist);
  font-size: 0.875rem;
  line-height: 1.45;
}
.hm-footer-logo {
  display: block;
  width: 10.5625rem;
  margin-bottom: 1.25rem;
  color: var(--hm-white);
}
.hm-footer-logo svg {
  display: block;
  width: 100%;
  height: auto;
}
.hm-footer p {
  max-width: 40rem;
  margin: 0 0 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
  .hm-top,
  .hm-logo,
  .hm-menu,
  .hm-menu-list a,
  .hm-menu-list a::before,
  .hm-drawer-backdrop,
  .hm-drawer-panel,
  .hm-drawer-head svg {
    transition: none;
  }
}
