@media (min-width: 47.5rem) {
  #app {
    grid-template-rows: var(--masthead-height) minmax(0, 1fr);
  }

  .masthead {
    grid-template-columns: minmax(7rem, 1fr) minmax(0, auto) minmax(7rem, 1fr);
    padding: var(--space-sm) var(--space-lg);
  }

  .masthead-rule {
    display: block;
    height: 1px;
    background: var(--color-ink);
  }

  .masthead h1 {
    padding-inline: var(--space-lg);
    overflow: hidden;
    font-size: clamp(2rem, 3.1vw, 2.75rem);
    text-align: center;
    text-overflow: ellipsis;
  }

  .masthead-actions {
    justify-self: end;
  }

  .app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .workbench {
    position: relative;
    inset: auto;
    z-index: 1;
    grid-column: 1;
    grid-row: 1;
    width: auto;
    height: auto;
    min-height: 0;
    border-top: 0;
    border-inline-end: 1px solid var(--color-ink);
    box-shadow: none;
    transform: none;
    visibility: visible;
    transition: none;
  }

  .tool-tabs {
    display: grid;
  }

  .sheet-grip,
  .sheet-close,
  .mobile-actions {
    display: none;
  }

  .map-stage {
    position: relative;
    grid-column: 2;
    grid-row: 1;
  }

  .tool-tab {
    min-height: 4rem;
    font-size: var(--text-caption);
  }

  .map-legend {
    inset: auto var(--space-md) calc(2rem + var(--space-md)) auto;
  }

  dialog {
    width: min(90vw, 58rem);
  }
}

@media (min-width: 75rem) {
  :root {
    --sidebar-width: 26rem;
  }

  .tool-tab {
    grid-template-columns: auto auto;
    place-content: center;
    gap: var(--space-xs);
  }
}

@media (max-width: 25rem) {
  .masthead h1 {
    font-size: 1.55rem;
  }

  .masthead-actions {
    gap: var(--space-2xs);
  }

  .masthead .icon-button {
    display: none;
  }

  .map-legend {
    width: 12.5rem;
  }
}

@media (max-width: 47.49rem) {
  .record-dialog,
  .about-dialog {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
  }

  .dialog-header {
    min-height: var(--masthead-height-mobile);
    padding: var(--space-sm) var(--space-md);
  }

  .dialog-header h2 {
    font-size: 1.45rem;
  }

  .record-content,
  .about-content {
    max-height: calc(100dvh - var(--masthead-height-mobile));
    padding: var(--space-md);
    padding-bottom: calc(var(--space-xl) + env(safe-area-inset-bottom));
  }

  .record-definitions,
  .relationship-list li {
    grid-template-columns: minmax(0, 1fr);
  }

  .record-definitions dt {
    padding-bottom: 0;
    border-bottom: 0;
    font-size: var(--text-caption);
  }

  .record-definitions dd {
    padding-top: 0;
  }

  .relationship-list li {
    align-items: start;
    gap: var(--space-xs);
    padding-block: var(--space-sm);
  }

  .relationship-target {
    width: 100%;
  }

  .relationship-certainty {
    justify-self: start;
  }

  .coordinate-copy {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--space-xs);
  }

  .coordinate-copy-label {
    text-align: start;
  }

  .media-image {
    height: min(46vh, 23rem);
    min-height: 14rem;
  }

  .media-caption {
    grid-template-columns: minmax(0, 1fr);
  }

  .media-attribution {
    text-align: start;
  }

  .media-controls {
    gap: var(--space-xs);
  }

  .media-thumbnail {
    flex-basis: 3.75rem;
  }

  .map-preview {
    min-width: min(15rem, calc(100vw - 5rem));
  }
}

@media (orientation: landscape) and (max-height: 35rem) and (max-width: 63.99rem) {
  :root {
    --sheet-height: min(86dvh, 30rem);
  }

  .sheet-grip {
    margin-block: var(--space-2xs) 0;
  }

  .tool-tab {
    min-height: 3rem;
    grid-template-columns: auto auto;
    gap: var(--space-xs);
  }
}
