:root {
  color-scheme: light;
  --ink: #181817;
  --soft-ink: rgba(24, 24, 23, 0.58);
  --paper: #e9e6de;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
}

body {
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  overflow-x: hidden;
}

button,
a {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.page {
  isolation: isolate;
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(1.1rem, 3vh, 2.2rem) clamp(1rem, 4vw, 3.5rem) clamp(1rem, 2.5vh, 1.8rem);
  overflow: hidden;
}

.drawing {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url("./assets/manga-garden.png") center bottom / cover no-repeat;
  filter: contrast(0.94) brightness(1.02);
}

.page::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(239, 236, 227, 0.22), rgba(239, 236, 227, 0) 32%),
    radial-gradient(circle at center, rgba(239, 236, 227, 0.04) 35%, rgba(30, 29, 27, 0.06) 100%);
}

header {
  text-align: center;
}

.domain {
  display: inline-block;
  font-family: Baskerville, "Iowan Old Style", "Times New Roman", serif;
  font-size: clamp(2.8rem, 6vw, 5.2rem);
  font-style: italic;
  letter-spacing: -0.065em;
  line-height: 0.9;
  text-decoration: none;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.28);
}

.game {
  position: relative;
  align-self: center;
  justify-self: center;
  width: min(620px, 100%);
  margin-top: clamp(0.5rem, 5vh, 3.5rem);
}

.hud {
  position: absolute;
  inset: 0.1rem 0 auto;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  padding-inline: 0.35rem;
  color: var(--soft-ink);
  font-family: "Courier New", monospace;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  pointer-events: none;
}

canvas {
  display: block;
  width: 100%;
  height: clamp(235px, 38vh, 310px);
  cursor: ew-resize;
  touch-action: none;
}

.game-layer {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.9rem;
  text-align: center;
  transition: opacity 180ms ease;
}

.game-layer.hidden {
  opacity: 0;
  pointer-events: none;
}

.game-layer p {
  margin: 0;
  padding: 0.2rem 0.55rem;
  background: rgba(233, 230, 222, 0.7);
  color: rgba(24, 24, 23, 0.72);
  font-family: "Courier New", monospace;
  font-size: clamp(0.72rem, 2vw, 0.82rem);
  line-height: 1.55;
}

.game-layer button {
  padding: 0.2rem 0.15rem 0.12rem;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  font-family: Baskerville, "Iowan Old Style", serif;
  font-size: 1.25rem;
  font-style: italic;
  cursor: pointer;
}

.game-layer button:hover,
.game-layer button:focus-visible,
footer a:hover,
footer a:focus-visible,
.domain:hover,
.domain:focus-visible {
  opacity: 0.55;
}

footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.65rem;
}

footer a {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  text-decoration: none;
  transition: opacity 150ms ease, transform 150ms ease;
}

footer a:hover,
footer a:focus-visible {
  opacity: 0.55;
  transform: translateY(-1px) rotate(-2deg);
}

.contact-icon {
  width: 1.9rem;
  height: 1.9rem;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-icon .sketch-echo {
  opacity: 0.2;
  stroke-width: 0.8;
}

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

@media (max-width: 640px) {
  .page {
    padding-inline: 0.7rem;
  }

  .drawing {
    background-position: 44% bottom;
  }

  .game {
    margin-top: 0;
  }

  canvas {
    height: min(39vh, 280px);
  }
}

@media (max-height: 650px) and (min-width: 641px) {
  .page {
    padding-block: 0.8rem;
  }

  .domain {
    font-size: 3.2rem;
  }

  .game {
    margin-top: 0;
  }

  canvas {
    height: 240px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.001ms !important;
  }
}
