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

@font-face {
  font-family: "OTTO";
  src: url("../assets/fonts/W95FA.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
}
body {
  font-family: Arial, Helvetica, sans-serif;
  background: silver;
  margin: 0;
  height: 100vh;
  overflow: hidden;
}

header {
  grid-area: header;
  background: silver;
}

.header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin: 3px;
}
.header img {
  width: 40px;
  height: 30px;
  object-fit: contain;
}
.header h1 {
  font-size: 20px;
  color: rgba(255, 255, 0, 0.7803921569);
}

.header__buttons {
  display: flex;
  background: silver;
  width: 50%;
  padding: 2px;
}
.header__buttons button {
  font-family: "OTTO", Arial, Helvetica, sans-serif;
  border: 0;
  background: transparent;
  width: 60px;
}
.header__buttons button:hover {
  box-shadow: 1px 1px black, inset -1px -1px gray, inset 1px 1px white;
}

main {
  grid-area: main;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.canvas {
  border: 1px solid black;
  background-color: white;
  width: 100%;
  height: 100%;
}

footer {
  grid-area: footer;
  width: 100%;
  background: silver;
  padding: 4px;
}

.container {
  display: grid;
  border: 1px solid white;
  grid-template-areas: "aside main main" "footer footer footer";
  grid-template-columns: 52px 1fr;
  grid-template-rows: 1fr auto;
  height: 100vh;
}

aside {
  grid-area: aside;
  background: silver;
  width: 52px;
  padding-top: 2px;
}
aside nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
}
aside button {
  width: 24px;
  height: 24px;
  border: 1px solid #000;
  background: #bdbdbd no-repeat center;
  border: 1.5px solid #eee;
  border-right-color: #000;
  border-bottom-color: #000;
  image-rendering: pixelated;
}
aside button.active {
  background-color: #eeeeee;
  border-color: #000;
  border-right-color: #eee;
  border-bottom-color: #eee;
}
aside button[disabled] {
  pointer-events: none;
  opacity: 0.5;
}

/*# sourceMappingURL=main.css.map */

/* =======================================================
   Responsive / touch layer
   ======================================================= */

/* Without this the browser treats a drag on the canvas as a scroll or a
   pinch and never delivers the pointermove events drawing needs. */
.canvas {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* The grid template only ever named two of its three columns, so the
   sidebar and canvas were sharing a row by accident. */
.container {
  grid-template-areas:
    "aside main"
    "footer footer";
  grid-template-columns: 52px 1fr;
  /* svh keeps the toolbar reachable when a mobile URL bar is showing. */
  height: 100svh;
}

footer {
  display: flex;
  align-items: center;
  gap: 8px;
}

#color-picker {
  width: 44px;
  height: 28px;
  padding: 0;
  border: 1px solid #000;
  background: silver;
  cursor: pointer;
}

/* Each tool set its icon with the `background` shorthand, which resets
   repeat/position/colour. That left the icons tiling from the top-left
   and outranked (by id specificity) the grey `.active` highlight, so the
   selected tool never lit up. Set the image alone and keep the rest. */
aside button {
  background-color: #bdbdbd;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px;
}

#draw-btn      { background-image: url(../assets/icons/draw.png); }
#erase-btn     { background-image: url(../assets/icons/erase.png); }
#rectangle-btn { background-image: url(../assets/icons/rectangle.png); }
#ellipse-btn   { background-image: url(../assets/icons/ellipse.png); }
#picker-btn    { background-image: url(../assets/icons/picker.png); }
#clear-btn     { background-image: url(../assets/icons/trash.png); }

aside button.active { background-color: #eeeeee; }

/* Fingers need targets they can actually hit. 24px squares are fine for
   a mouse and useless for a thumb. */
@media (pointer: coarse) {
  aside button {
    width: 40px;
    height: 40px;
    background-size: 22px;
  }
  #clear-btn { background-size: 24px; }
  #color-picker { width: 56px; height: 36px; }
}

/* Narrow viewport: a vertical toolbar costs width the drawing needs
   more, so the tools move to a row above the canvas. */
@media (max-width: 480px) {
  .container {
    grid-template-areas:
      "aside"
      "main"
      "footer";
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }

  aside {
    width: 100%;
    padding: 3px;
  }

  aside nav {
    flex-wrap: nowrap;
    justify-content: center;
    gap: 4px;
  }

  aside button {
    width: 42px;
    height: 42px;
    background-size: 22px;
    background-position: center;
  }

  #clear-btn { background-size: 24px; }

  footer { justify-content: center; }
}
