/* Sudoku Cafe: base. Every size comes from one unit (--u): 100u is the width of the stage standing up,
   or its height lying down. Art from assets/; stretchable pieces are put together by src/lib/nine.js. */
/* One file per weight (static cuts of the variable font). A browser that cannot read variable
   fonts drew every text at the thinnest weight. Cyrillic, Japanese, Korean and Chinese fall back to the system font. */
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-ext-400.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-400.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: 'Fredoka';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-ext-500.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-500.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: 'Fredoka';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-ext-600.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-600.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: 'Fredoka';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-ext-700.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-700.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;
}
:root {
  --u: min(1vw, 0.562vh, 5.6px);
  --u: min(1vw, 0.562dvh, 5.6px);
  --b: calc(89 * var(--u)); /* board side */
  --peek: calc(25 * var(--u)); /* height of the cat over the board */
  --ar: 0.575; /* background art: width / height */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --cap: 0.02em; /* Fredoka sits a hair high in its line box: every centred label goes down by this */
  --ink: #ffffff;
  --soft: #b9c7b4;
  --sky: #8fd3a6;
  --amber: #f28f22;
  --gold: #ffb94d;
  --mint: #7fe0a0;
  --well: #2b1a11;
  --pink: #ff9f8c;
  --spring: cubic-bezier(0.22, 1.5, 0.4, 1);
}
@media (orientation: landscape) {
  :root {
    --u: min(1vh, 0.62vw, 11px);
    --u: min(1dvh, 0.62vw, 11px);
    --b: calc(65 * var(--u));
    --peek: calc(19 * var(--u));
    --ar: 1.777;
  }
} /* a phone lying down: the height is the scarce thing, so the board takes most of it and the cat gets small */
@media (orientation: landscape) and (max-height: 520px) {
  :root {
    --b: calc(77 * var(--u));
    --peek: calc(10 * var(--u));
  }
}

/* system fonts (Japanese, Korean, Chinese) sit higher in the line than Fredoka */
:lang(ja),
:lang(ko),
:lang(zh) {
  --cap: 0.07em;
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #1a0f0a;
  color: var(--ink);
  font-family:
    'Fredoka', 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Noto Sans JP',
    'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', system-ui,
    sans-serif;
  font-weight: 500;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
[hidden] {
  display: none !important;
}
b {
  font-weight: 600; /* titles and labels: semibold is the heaviest weight of the interface */
}
img {
  -webkit-user-drag: none;
}
button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  outline: none;
}
button:disabled {
  cursor: default;
}
#app {
  /* the size the menu art has on screen (it always covers it), where the cat sits in the art, and --p: which
     part of the art stays on screen when its sides are cropped (0.5 = centred, near 0 = the left side, where the cat sits) */
  --sw: max(100vw, 100vh * var(--ar));
  --sw: max(100vw, 100dvh * var(--ar));
  --sh: max(100vh, 100vw / var(--ar));
  --sh: max(100dvh, 100vw / var(--ar));
  --x: 0.265;
  --y: 0.613;
  --k: 0.26;
  --p: 0.5;
  --ox: calc((100vw - var(--sw)) * var(--p)); /* where the left edge of the art is */
  --oy: calc((100vh - var(--sh)) / 2); /* where its top edge is */
  --oy: calc((100dvh - var(--sh)) / 2);
  position: fixed;
  inset: 0;
  overflow: hidden;
  overflow: clip; /* never scrolls, not even when a button takes the focus */
}

/* ---- the scene: the background art always covers the screen; what stands on it is placed in % of the art ---- */
/* The scene never gets bigger than the screen (a bigger box could be scrolled sideways): the art covers it, and
   --sw / --sh are the size the art has on screen, so a piece is placed at "50% + (x - 0.5) * size of the art". */
.scene {
  position: absolute;
  inset: 0;
  z-index: 0; /* its own layer: nothing inside it ever sits over the buttons */
  overflow: hidden;
  pointer-events: none;
  background: #1a0f0a url(../assets/bg/pe.webp) calc(var(--p) * 100%) center / cover no-repeat;
}
/* the game screen has its own view of the cafe (no window, no cup): it fades in over the menu view */
.scene::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url(../assets/bg/jogo-pe.webp) center / cover no-repeat;
  opacity: 0;
  transition: opacity 0.4s ease-out;
}
#app[data-screen='game'] .scene::after {
  opacity: 1;
}
.calm .scene::after {
  transition-duration: 1ms;
}
.sky {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}
.menu-mascot {
  position: absolute;
  left: calc(var(--ox) + var(--x) * var(--sw));
  top: calc(var(--oy) + var(--y) * var(--sh));
  height: calc(var(--k) * var(--sh));
  aspect-ratio: 909 / 1428; /* the sit frames, cut tight */
  translate: -50% -100%;
  z-index: 2;
  transition: opacity 0.25s;
}
.menu-mascot::before {
  /* contact shadow on the counter, straight under the cat (the lamps hang above it): a dark core under the paws and
     haunches, a softer footprint under the body and the tail. No coloured halo. */
  content: '';
  position: absolute;
  left: -3%;
  right: -3%;
  bottom: -4.5%;
  height: 16%;
  z-index: -1;
  background:
    radial-gradient(36% 32% at 38% 44%, rgba(18, 7, 2, 0.9), rgba(18, 7, 2, 0.65) 45%, rgba(18, 7, 2, 0)),
    radial-gradient(52% 46% at 55% 50%, rgba(18, 7, 2, 0.6), rgba(18, 7, 2, 0.35) 50%, rgba(18, 7, 2, 0));
}
/* a squarish window standing up (tablet): the whole art shows and the logo comes down to the cat's ears; the cat
   sits a little further left and a little smaller */
@media (orientation: portrait) and (min-aspect-ratio: 3/5) {
  #app {
    --x: 0.22;
    --k: 0.25;
  }
}
@media (orientation: landscape) {
  #app {
    --x: 0.183;
    --y: 0.66;
    --k: 0.45;
    --p: 0.06; /* a narrow window crops the right side (window, cup), never the cat */
    /* On a narrow (squarish) window the cat would sit under the logo and the buttons: they move right by what is
       missing, together, and never past the right edge. On a wide screen this is zero. */
    --panda-right: calc(
      var(--ox) + var(--x) * var(--sw) + var(--k) * var(--sh) * 0.32
    ); /* half the frame: the tail tip */
    --shift: clamp(0px, calc(var(--panda-right) + 3 * var(--u) - (50vw - 28 * var(--u))), calc(50vw - 36 * var(--u)));
  }
  .scene {
    background-image: url(../assets/bg/deitado.webp);
  }
  .scene::after {
    background-image: url(../assets/bg/jogo-deitado.webp);
  }
}
/* A squarish window lying down (tablet 4:3, a desktop window): the art keeps its whole width (window, lamps, cup and
   plant never cut by the screen edge), sits on the bottom (the uncropped -alto picture, its 7.8% below the screen), and the wall above continues with its top row
   stretched up (the lamp cords run on to the top). Everything placed on the art follows: --sw, --sh, --oy. */
@media (orientation: landscape) and (max-aspect-ratio: 16/9) {
  #app {
    --sw: 100vw;
    --sh: calc(100vw / var(--ar));
    --oy: calc(100vh - var(--sh));
    --oy: calc(100dvh - var(--sh));
  }
  .scene {
    background:
      url(../assets/bg/deitado-alto.webp) center bottom -5.2vw / 100% auto no-repeat,
      url(../assets/bg/deitado-topo.webp) center / 100% 100% no-repeat,
      #10200f;
  }
  .scene::after {
    background:
      url(../assets/bg/jogo-deitado-alto.webp) center bottom -5.2vw / 100% auto no-repeat,
      url(../assets/bg/jogo-deitado-topo.webp) center / 100% 100% no-repeat;
  }
}
#app:not([data-screen='menu']) .menu-mascot,
#app[data-panel] .menu-mascot {
  opacity: 0;
}
.mascot {
  transform-origin: 50% 100%;
  animation: mascot-breathe 3.4s ease-in-out infinite;
}
.mascot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}
.mascot img.on {
  opacity: 1;
}
@keyframes mascot-breathe {
  50% {
    scale: 1.012 1.028;
  }
}
.float {
  position: absolute;
  left: calc(var(--ox) + var(--fx) * var(--sw));
  top: calc(var(--oy) + var(--fy) * var(--sh));
  width: calc(var(--fs) * var(--sw));
  aspect-ratio: 1;
  translate: -50% -50%;
  background: url(../assets/fx/lantern.webp) center / contain no-repeat;
  transition: opacity 0.4s ease-out;
  animation: bob 5s ease-in-out var(--fd, 0s) infinite;
}
@keyframes bob {
  50% {
    translate: -50% -56%;
  }
}
#app[data-screen='game'] .float {
  opacity: 0;
}
.calm .float {
  animation: none;
}
.fx img {
  filter: hue-rotate(5deg) saturate(0.95);
}
.sky i {
  /* a soft halo keeps the steam readable over the bright window lights too */
  filter: brightness(1.2) drop-shadow(0 0 0.25vmin rgba(255, 240, 220, 0.45));
}
/* Steam rises from the cup painted on the counter of the menu view (x, start height and size as fractions of the art,
   lanes in src/main.js): faint, small, and only at the cup. */
.sky i {
  position: absolute;
  left: calc(var(--ox) + var(--fx) * var(--sw));
  top: calc(var(--oy) + var(--fy) * var(--sh));
  width: calc(var(--fs) * var(--sw));
  aspect-ratio: 158 / 360;
  translate: -50% 0;
  opacity: 0;
  background: url(../assets/fx/sky.webp) center / contain no-repeat;
  animation: sky-rise var(--d) linear var(--dl) infinite;
}
.sky {
  transition: opacity 0.4s ease-out;
}
#app[data-screen='game'] .sky {
  opacity: 0;
}
@keyframes sky-rise {
  15% {
    opacity: var(--so, 0.75);
  }
  55% {
    opacity: calc(var(--so, 0.75) * 0.8);
  }
  to {
    translate: -50% calc(-1 * var(--rise) * var(--sh));
    opacity: 0;
  }
}
.calm .mascot,
.calm .sky i,
.calm .tap .pilltext,
.calm .breathe {
  animation: none;
}

/* ---- screens ---- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: var(--sat) 0 var(--sab);
  display: none;
  flex-direction: column;
  align-items: center;
}
.screen.on,
#menu[data-leaving],
#game[data-leaving] {
  display: flex;
}
#game[data-leaving] {
  pointer-events: none;
}
#menu[data-leaving] > * {
  pointer-events: none !important;
}

/* ---- pieces of stretchable art (see src/lib/nine.js) ---- */
.btn,
.ib,
.tool,
.key,
.pill,
.chip,
.panel,
.band,
.card,
.item,
.rowb,
.row,
.fact,
.stat,
.board,
.pilltext {
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.amber {
  --nine: btn-amber;
}
.teal {
  --nine: btn-teal;
}
.indigo {
  --nine: btn-indigo;
}
.navy {
  --nine: btn-navy;
}
#btn-continue {
  color: var(--gold);
}
#btn-continue small {
  color: #fff;
}
.btn.indigo {
  filter: brightness(0.93) saturate(1.06);
}
.btn.indigo[data-down] {
  filter: brightness(0.84);
}
/* End of css/01-base.css (complete file). */
