/*
 * Gambit-specific styles. Layout primitives, reset, and form controls
 * come from amoeba (vendor/assets/stylesheets/amoeba.css).
 */

header,
footer {
  padding-block: var(--spacer-1);
  padding-inline: var(--spacer-1);
}

header a {
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
  overflow-wrap: anywhere;
}

header select {
  min-height: 44px;
  max-width: 100%;
  font-size: 16px;
  padding: 0;
  border: none;
  background: none;
}

.account-menu {
  position: relative;
}

.account-menu-trigger {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  min-height: 44px;
  line-height: 44px;
  padding: 0;
  text-align: inherit;
  text-decoration: underline;
}

.account-menu-panel {
  position: absolute;
  z-index: 10;
  inset-inline-end: 0;
  inset-block-start: 100%;
  min-inline-size: min(20rem, calc(100vw - 2rem));
  padding: var(--spacer-1);
  background: #fff;
  border: 1px solid #000;
  opacity: 1;
  transform: none;
  transform-origin: top inline-end;
  transition:
    display 180ms allow-discrete,
    overlay 180ms allow-discrete,
    opacity 180ms var(--ease-out),
    transform 180ms var(--ease-out);
}

.account-menu-panel[hidden] {
  display: none;
  opacity: 0;
  transform: translateY(-0.35rem) scale(0.96);
  pointer-events: none;
}

@starting-style {
  .account-menu-panel:not([hidden]) {
    opacity: 0;
    transform: translateY(-0.35rem) scale(0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  .account-menu-panel {
    transition: none;
  }
}

.account-switcher-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.account-switcher-button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: start;
  text-decoration: underline;
  &:disabled {
    cursor: default;
    text-decoration: none;
  }

}

input, textarea {
  font-size: 16px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
input:not([type]) {
  min-height: 44px;
}

button,
input[type="submit"],
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #000;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 1rem;
  min-height: 44px;
  text-decoration: none;
}

textarea {
  min-height: 6.5em;
  height: 6.5em;
}

.add-signal {
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
}

.cluster > form.button_to {
  display: contents;
}

.toast {
  position: fixed;
  z-index: 20;
  inset-block-end: var(--spacer-2);
  inset-inline-start: 50%;
  transform: translateX(-50%);
  max-inline-size: min(32rem, calc(100% - 2rem));
  padding: var(--spacer-1) var(--spacer-2);
  background: #000;
  color: #fff;
  text-align: center;
}

lexxy-editor {
  border: 1px solid #000;
  border-radius: 0;
  font-size: 16px;
  max-width: 100%;
}

lexxy-editor button,
lexxy-editor summary {
  background: var(--lexxy-color-canvas, #fff);
  color: var(--lexxy-color-text, #000);
  border: none;
  padding: 0;
  min-height: 0;
  font-size: inherit;
  line-height: normal;
}

table, tbody, tr, td {
  display: block;
  width: 100%;
}

thead {
  display: none;
}

td:empty {
  display: none;
}

lexxy-editor :is(table, thead, tbody, tr, th, td),
.lexxy-content :is(table, thead, tbody, tr, th, td) {
  display: revert;
  width: auto;
}

lexxy-editor tr,
.lexxy-content tr {
  margin-bottom: 0;
}

lexxy-editor td:empty,
.lexxy-content td:empty {
  display: table-cell;
}

td {
  overflow-wrap: anywhere;
}

tr {
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  textarea {
    height: auto;
    min-height: 9em;
  }

  table {
    display: table;
    width: auto;
  }

  tbody {
    display: table-row-group;
  }

  tr {
    display: table-row;
    margin-bottom: 0;
  }

  th, td {
    display: table-cell;
    width: auto;
  }

  thead {
    display: table-header-group;
  }

  td:empty {
    display: table-cell;
  }
}

/* ReActionView dev badge: default is top-right; Gambit nav uses that corner (development only). */
.env-development .herb-floating-menu {
  top: auto;
  right: auto;
  bottom: 0;
  left: 0;
}

.env-development .herb-floating-menu .herb-menu-trigger {
  border-radius: 0 12px 0 0;
  border-right: 1px solid var(--herb-rule);
  border-bottom: none;
  border-left: none;
  border-top: 1px solid var(--herb-rule);
}

.env-development .herb-floating-menu .herb-menu-panel {
  top: auto;
  bottom: 30px;
  left: 10px;
  right: auto;
}
