/* The hamburger button and the dialogs it opens. Colors come from the game's own
   variables, so the menu follows the seasons. */

#menu-button {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  /* At the top left, the bars line up with the page's edge, and the button's
     44-pixel target reaches into the margins rather than the status labels. */
  margin: -8px 0 -8px -9px;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: transparent;
}

#menu-button .bar {
  width: 26px;
  height: 3px;
  border-radius: 2px;
  background: var(--ink);
}

#menu-button:active {
  background: var(--card);
}

dialog {
  width: min(calc(100vw - 28px), 480px);
  max-height: calc(100dvh - 40px);
  padding: 0;
  border: none;
  border-radius: 20px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 12px 40px rgb(0 0 0 / 25%);
}

dialog::backdrop {
  background: rgb(31 42 48 / 45%);
}

dialog .sheet {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 40px);
  padding: 8px 18px 18px;
}

/* Opening a dialog focuses its card, not its first button, so a tap does not
   leave a button looking chosen. Keyboard users can still Tab to each button. */
dialog .sheet:focus {
  outline: none;
}

dialog .list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
}

dialog .page {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-top: 12px;
  font-size: 19px;
  line-height: 1.45;
  user-select: text;
  -webkit-user-select: text;
}

/* iPhone hides scroll bars, so a soft fade at the bottom shows there is more to
   read. At the end of the page it fades only empty space. */
dialog .page::after {
  content: "";
  position: sticky;
  bottom: 0;
  display: block;
  height: 32px;
  background: linear-gradient(rgb(255 255 255 / 0%), var(--card));
  pointer-events: none;
}

dialog h2 {
  margin: 0 0 12px;
  font-size: 26px;
  line-height: 1.2;
}

dialog a {
  color: var(--accent-dark);
  font-weight: 700;
}

dialog h3 {
  margin: 18px 0 8px;
  font-size: 22px;
  line-height: 1.2;
}

dialog p,
dialog ul,
dialog ol {
  margin: 0 0 12px;
}

dialog ul,
dialog ol {
  padding-left: 1.3em;
}

/* An icon drawn into a sentence, such as the Share button, the height of a letter. */
dialog .glyph {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
}

dialog li {
  margin-bottom: 6px;
}

dialog pre {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--paper);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

dialog .item {
  min-height: 56px;
  padding: 0 14px;
  border: none;
  border-bottom: 2px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 21px;
  font-weight: 700;
  text-align: left;
}

dialog .quiet {
  margin: 14px 14px 0;
  color: var(--quiet-ink, #47525a);
  font-size: 15px;
}

dialog .close {
  flex: none;
  min-height: 56px;
  margin-top: 14px;
  border: 2px solid var(--accent);
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 21px;
  font-weight: 700;
}

/* A set of choices, such as the levels. The chosen one is filled with the accent,
   white on which holds 7:1 in every season. */
dialog .choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

dialog .choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 64px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-align: left;
}

dialog .choice b {
  font-size: 21px;
}

dialog .choice span {
  font-size: 17px;
  line-height: 1.3;
}

dialog .choice[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

dialog .choice:active {
  transform: translateY(1px);
}

/* Starting over cannot be undone, so it is marked in a red that holds 7:1 on
   every season's card. */
dialog .item.danger {
  color: #9b1c1c;
}

dialog .danger-button {
  flex: none;
  min-height: 56px;
  margin-top: 14px;
  border: 2px solid #9b1c1c;
  border-radius: 14px;
  background: transparent;
  color: #9b1c1c;
  font: inherit;
  font-size: 21px;
  font-weight: 700;
}

dialog .item:active,
dialog .close:active,
dialog .danger-button:active {
  transform: translateY(1px);
}
