/* The ASCII menu: the full-screen menu of a small studio that makes tools for developers, alone on a black page.
   Everything you see in the menu is characters on a canvas; the links are real links laid over their words. On a
   real site give .term `position: fixed; inset: 0; width: auto; height: auto`, and the button keeps to its corner. */
:root {
  --page: #000000;          /* the page */
  --ink: #ecebe6;           /* the big words */
  --dim: #6d6b66;           /* the notes, and the characters of the wave */
  --mark: #2c2b29;          /* the faint marks of the grid */
  --accent: #ff6b3d;        /* the page you are on, and the focus */
  --key: #151514;           /* the button */
  --key-edge: #3a3936;      /* the button's edge */
}

* {
  box-sizing: border-box;
}

/* a tap is a click at once: no wait for a double tap */
html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  -webkit-font-smoothing: antialiased;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

a:focus,
button:focus {
  outline: none;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 24px 16px;
}

/* ---------------------------------------------------------------- the screen */
.term {
  position: relative;
  width: min(620px, 100%);
  height: 480px;
}

.term__screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------------------------------------------------------------- the links */
/* each link is laid by the script over its big word: the word itself is drawn on the canvas */
.term__menu {
  position: absolute;
  inset: 0;
  visibility: hidden;
}

.term__menu.is-open {
  visibility: visible;
}

.term__list {
  display: contents;
}

.word {
  position: absolute;
  left: 0;
  top: 0;
  color: transparent;
  font-size: 1px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------------------------------------------------------------- the button */
/* the script moves it: in the middle while the menu is closed, in the top right corner while it is open */
.key {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  margin: 0;
  padding: 0 16px 0 18px;
  border: 1px solid var(--key-edge);
  border-radius: 4px;
  background: var(--key);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}

/* the word is as wide as the longer of Menu and Close, so the button keeps its size */
.key__word {
  display: inline-block;
  min-width: 5ch;
  white-space: pre;
}

.key__icon {
  width: 16px;
  height: 12px;
  flex: none;
  overflow: visible;
}

.key__icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: square;
}

@media (hover: hover) and (pointer: fine) {
  .key:hover {
    border-color: var(--ink);
  }
}

.key:active {
  background: #000;
}

.key:focus-visible {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 420px) {
  .term {
    height: 520px;
  }
}
