:root {
  cursor: default;
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
  text-size-adjust: none;
  -webkit-text-size-adjust: none;
  color-scheme: light dark;
  --navbar-height: 44px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --secondary-bg: #333;
  }
}
@media (prefers-color-scheme: light) {
  :root {
    --secondary-bg: #E6E6E6;
  }
}
@view-transition {
  navigation: auto;
}
*,
::before,
::after {
  box-sizing: border-box;
}
html {
  /* font: -apple-system-body; */
  font-family: serif;
}
abbr[title] {
  text-decoration: underline;
  text-decoration: underline dotted;
}
a {
  text-decoration: 1px dotted underline;
}
body,
button,
input,
select,
textarea {
  margin: 0;
}
#dialog {
  max-width: 40em;
  border: 3px solid CanvasText;
  padding: 1em;
  width: 24em;
  max-width: 95vw;
}
#dialog h1 {
  font-size: 1.5rem;
}
#dialog-contents a {
  word-wrap: break-word;
}
.vbox {
  display: flex;
  flex-direction: column;
}
.vbox label,
.vbox label * {
  margin-bottom: 0.5em;
}
.vbox label {
  display: block;
}
.error {
  color: red;
}
.hidden {
  display: none;
}

input {
  outline-offset: 0;
}

input[type="color"],
input[type="date"],
input[type="datetime"],
input[type="datetime-local"],
input[type="email"],
input[type="month"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="text"],
input[type="time"],
input[type="url"],
input[type="week"],
select,
select:focus,
textarea {
  border: 1px solid GrayText;
  border-radius: 4px;
  width: 100%;
  padding: 0.5em;
}

.focushack {
  width: 0 !important;
  height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

textarea {
  max-width: 100%;
}

.btn-disabled {
  cursor: not-allowed;
}

.inline,
.inline a,
.inline input {
  display: inline;
}
.buttons {
  display: flex;
  justify-content: flex-end;
  padding: 0.5em 0;
}
.reverse {
  flex-direction: row-reverse;
  justify-content: flex-start;
}
.buttons input,
.buttons button {
  margin-right: 1em;
}
.buttons input:last-child,
.buttons button:last-child {
  margin-right: 0;
}

.buttons.reverse input,
.buttons.reverse button {
  margin-right: 1em;
}
.buttons.reverse input:first-child,
.buttons.reverse button:first-child {
  margin-right: 0;
}

.content {
  max-width: 64em;
  margin: 0 auto;
}
nav h1 {
  display: inline-block;
}
nav img {
  position: relative;
  top: 0.5em;
}
nav {
  border-bottom: 1px solid CanvasText;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  grid-template-areas: "leading title trailing";
  column-gap: 0.5em;
  align-items: center;
  justify-content: space-between;
}
nav > * {
  white-space: nowrap;
}
nav .leading {
  grid-area: leading;
}
nav .title {
  grid-area: title;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
nav .trailing {
  grid-area: trailing;
  justify-self: end;
}
nav .links {
  display: flex;
  justify-content: end;
}
nav .links a {
  padding: 0.5em;
}
nav .links a:last-child {
  padding-right: 0;
}
footer {
  border-top: 1px solid CanvasText;
  margin-top: 1em;
  padding: 1em 0 1.5em 0;
}

.gallery {
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  gap: 1em;
}
.gallery figure {
  width: 12em;
  margin: 0;
}
.gallery figure img {
  width: 12em;
  height: 12em;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border: 3px solid LinkText;
}
.gallery label {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
}
.gallery a:active img {
  border-color: ActiveText;
}
.gallery a:visited img {
  border-color: VisitedText;
}

.gallery figure:has(input:checked) {
  background-color: rgba(0.5, 0.5, 0.5, 0.2);
}

.gallery input[type="checkbox"] {
  margin: 0;
}

.edit {
  display: block;
  width: 100%;
  text-align: right;
  margin-top: 1em;
}

.edit + h1 {
  margin-top: 0.5em !important;
}

.sidebar-grid {
  margin-top: 1em;
  display: grid;
  grid-template-columns: 1fr 3fr;
  grid-template-areas: "sidebar main";
  column-gap: 0.5em;
}

.sidebar-grid.wide {
  grid-template-columns: 2fr 3fr;
}

.sidebar {
  grid-area: sidebar;
  border: 1px solid CanvasText;
  border-radius: 3px;
  padding: 0 1em 1em 1em;
  font-size: 1rem;
}

.sidebar h1 {
  font-size: 1.2em;
  margin-bottom: 0.2em;
  margin-top: 1em;
}

.sidebar h2 {
  font-size: 1em;
  margin-bottom: 0.2em;
  margin-top: 1em;
}

.sidebar ul {
  margin-top: 0;
  padding-left: 1.25em;
}

.baseline {
  display: flex;
  align-items: baseline;
  gap: 0.25em;
}

.zstack {
    display: grid;
    grid-template-rows: 100% 1fr;
    grid-template-columns: 100% 1fr;
}
.zstack * {
    grid-area: 1/1/2/2;
}

.main-image {
  grid-area: main;
}

.main-image .height-limit {
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  display: block;
}

.main-image label:has(input:checked) ~ div .height-limit,
.main-image label:has(input:checked) ~ div picture .height-limit,
.main-image label:has(input:checked) ~ img.height-limit
{
  max-height: 95vh;
  width: auto;
}

.main-image picture + p {
    margin: 0.5em 0 0 0;
}

.links > a {
  overflow: hidden;
}

.menu-button-container {
  display: none;
  height: 100%;
  color: LinkText;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#menu-toggle {
  display: none;
}

@media (max-width: 639px) {
  .desktop-only {
    display: none;
  }
  html,
  body {
    font-size: 18px;
  }
  .sidebar-grid {
    display: block;
  }
  .sidebar {
    border: none;
    padding: 0;
  }
  .menu-toggle,
  .menu-button-container {
    display: block;
  }
  .menu-button-container {
    display: flex;
    stroke: LinkText;
  }
  nav {
    border-bottom: 0;
    z-index: 99;
    grid-template-rows: var(--navbar-height);
    position: sticky;
    top:0;
    background-color: Canvas;
    padding: 0 8px;
  }
  nav .links {
    position: absolute;
    top: 0;
    margin-top: var(--navbar-height);
    left: 0;
    flex-direction: column;
    width: 100%;
    justify-content: center;
    align-items: center;
  }
  nav h1 {
    margin: 0;
    font-size: 1.25em;
  }
  #menu-toggle ~ .links a {
    height: 0;
    margin: 0;
    padding: 0;
    transition: height 400ms cubic-bezier(0.23, 1, 0.32, 1);
  }
  #menu-toggle:checked ~ .links a {
    /* border: 1px solid #333; */
    height: 2.5em;
    padding: 0.5em;
    transition: height 400ms cubic-bezier(0.23, 1, 0.32, 1);
  }
  .links > a {
    display: flex;
    justify-content: right;
    margin: 0;
    padding: 0.5em 0;
    width: 100%;
  }
  .links > a:last-child {
    border-bottom: 3px solid CanvasText;
  }
  footer {
    padding-left: 8px;
    padding-right: 8px;
  }
  .content > * {
    margin-left: 8px;
    margin-right: 8px;
  }
  .ignore-safe-area {
    margin-left: 0;
    margin-right: 0;
  }
  .gallery {
    gap: 0.5em;
  }
  .gallery figure {
    width: calc(50% - 0.25em);
  }
  .gallery figure img {
    max-width: 100%;
    max-height: 10em;
  }
  .gallery figure span {
    overflow-x: hidden;
    text-overflow: ellipsis;
  }
  .secondary-bg {
    background-color: var(--secondary-bg);
  }
  input[type="color"],
  input[type="date"],
  input[type="datetime"],
  input[type="datetime-local"],
  input[type="email"],
  input[type="month"],
  input[type="number"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  input[type="text"],
  input[type="time"],
  input[type="url"],
  input[type="week"],
  input[type="submit"],
  input[type="reset"],
  button,
  select,
  select:focus,
  textarea {
    font-size: 16px;
  }
  .buttons {
    flex-wrap: wrap;
  }

  .queue-container {
    flex-direction: column;
    flex-wrap: nowrap;
  }

  .queue-record {
    flex: 1 1 100%;
  }

  .sticky-top:not(nav) {
    top: calc(var(--navbar-height) + 1px);
    z-index: 0;
  }

  #loader {
    top: calc(var(--navbar-height) + 3px) !important;
    z-index: 100;
  }
  dialog #loader {
      top: 0;
  }
}

@media (min-width: 640px) {
  .mobile-only {
    display: none;
  }
  nav .trailing-desktop-only {
    grid-area: trailing;
    justify-self: end;
  }
  .queue-container {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .queue-record {
    flex: 1 1 32%;
  }
}

.input-cell {
  display: inline-flex;
  width: 100%;
}

table {
  border-top: 2px solid CanvasText;
  border-bottom: 2px solid CanvasText;
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
  text-align: left;
  word-wrap: anywhere;
}
thead {
  border-bottom: 1px solid CanvasText;
}
th,
td {
  padding: 0.2em;
  vertical-align: top;
  line-height: 1.5em;
}

table .txt {
  text-align: left;
}

table .num {
  text-align: right;
}

table img {
  display: block;
  max-width: 12em;
  max-height: 12em;
  width: auto;
  height: auto;
}

.pages {
  display: flex;
  gap: 0.5em;
  justify-content: space-between;
}

.group {
  margin-top: 1.5em;
}

.count {
  color: GrayText;
  font-size: 0.9em;
  margin-left: 0.75rem;
}

.rule-box {
  margin-bottom: 0.5em;
  border-bottom: 1px solid CanvasText;
}

.constrain-width {
  width: 100%;
  height: auto;
  max-width: 95vw;
}

.queue-container {
  display: flex;
  gap: 0.5em;
}

.queue-record {
  border: 3px solid CanvasText;
  padding: 0.5em;
  display: flex;
  gap: 0.5em;
}

.queue-record:target,
figure:target {
  scroll-margin-top: 6lh;
  scroll-snap-margin-top: 6em;
  background: rgba(255, 255, 0, 0.1);
  border: 3px dashed #FF0;
}

.queue-record img {
  max-height: 10em;
  width: auto;
  max-width: 100%;
}

.queue-record p {
  margin-top: 0.5em;
  margin-bottom: 0em;
}

.queue-record a,
.queue-record p {
  word-wrap: anywhere;
}

.queue-record input {
  margin: 0;
}

.queue-record ul {
  margin: 0;
  padding-left: 1em;
}

.checkbox-bullets {
  list-style-type: none;
  padding-left: 1em;
}

.checkbox-bullet {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  margin-bottom: 0.5em;
}

.checkbox-bullet input {
  margin: 0;
}

.checkbox-bullet p {
  margin: 0;
}

.t-check {
  width: 7%;
}

.t-main {
  width: 23%;
}

.t-btn {
  width: 7%;
}

dt {
  font-weight: bold;
}

dt:target {
  background: rgba(255, 255, 0, 0.5);
}

dd + dt {
  margin-top: 1em;
}

abbr {
  font-variant-caps: all-small-caps;
}

#dialog {
  width:100%;
  max-width: 30em;
}

.error {
  color: red;
}

#loader-wrap {
  overflow-x: clip;
  width: 100%;
  background-color: transparent;
}

#loader {
  width: 200%;
  height: 0.25em;
  background: repeating-linear-gradient(-45deg, CanvasText 0 15px,#0000 0 20px) left/200% 100%;
  animation: l3 8s infinite linear;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
}
@keyframes l3 {
    100% {transform: translateX(-50%)}
}

dialog #loader {
  position: sticky;
}

.sticky-top {
  position: sticky;
  top:0;
  background-color: Canvas;
}

table.t50-25-25 {
  table-layout: fixed;
}

table.t50-25-25 th:first-child {
  width: 50%;
}

table.t50-25-25 th:nth-child(2) {
  width: 25%;
}

table.t50-25-25 th:nth-child(3) {
  width: 25%;
}

.list-item-block > li {
  margin-bottom: 1em;
}

.list-item-block > li > * {
  display: inline-block;
  vertical-align: text-top;
}

.list-item-block div {
  max-width: 100%
}

.list-item-block a {
  word-wrap: break-word;
}

