html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Gallery (Phase 3): square thumbnail grid, large touch targets, native dialog viewer. */
.bm-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 0.375rem;
}

.bm-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  border-radius: 0.375rem;
  overflow: hidden;
  background: var(--bs-secondary-bg);
  cursor: pointer;
}

.bm-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bm-tile:focus-visible {
  outline: 3px solid #258cfb;
  outline-offset: 2px;
}

.bm-tile-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0.25rem;
  font-size: 0.75rem;
  word-break: break-all;
  color: var(--bs-secondary-color);
}

.bm-tile-badge {
  position: absolute;
  right: 0.25rem;
  bottom: 0.25rem;
  padding: 0 0.3rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.65);
}

.bm-tile-badge-start {
  right: auto;
  left: 0.25rem;
  top: 0.25rem;
  bottom: auto;
  background: #b35c00;
}

.bm-viewer {
  width: min(960px, 100vw);
  max-width: 100vw;
  max-height: 100dvh;
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
}

.bm-viewer::backdrop {
  background: rgba(0, 0, 0, 0.8);
}

.bm-viewer-media {
  display: flex;
  justify-content: center;
  background: #000;
}

.bm-viewer-media img,
.bm-viewer-media video {
  max-width: 100%;
  max-height: 70dvh;
  object-fit: contain;
}

/* Phones and touch screens: primary controls at least 44 px high (WCAG 2.5.5, platform guidelines). The 14 px root font
   size makes Bootstrap's default buttons about 34 px on phones. */
@media (pointer: coarse), (max-width: 767.98px) {
  .btn:not(.btn-sm):not(.btn-link),
  .form-control:not(.form-control-sm),
  .form-select:not(.form-select-sm) {
    min-height: 44px;
  }

  .btn:not(.btn-sm):not(.btn-link) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}
